Hi, after added my own service classes, I got the following error:

samwun9988 wrote:
> 
> ...
>         at
> org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
>         at $Proxy0.invoke(Unknown Source)
>         at
> org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
>         at
> org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
>         at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> Failed to create service.
>         at
> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)
>         at
> org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
>         at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
>         ... 35 more
> Caused by: javax.wsdl.WSDLException: WSDLException:
> faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF
> in prolog
>  at [row,col,system-id]:
> [1,0,"http://127.0.0.1:4204/CategoryManagerImpl?wsdl";]
>         at
> org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:235)
>         at
> org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
>         at
> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
>         ... 37 more
> Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
>  at [row,col,system-id]:
> [1,0,"http://127.0.0.1:4204/CategoryManagerImpl?wsdl";]
>         at
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:682)
>         at
> com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2090)
>         at
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1996)
>         at
> com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1100)
>         at
> org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1050)
>         at
> org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:947)
>         at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:874)
>         at
> org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226)
>         ... 39 more
> 
> 

CalculatorTest.java:


> @WebServiceRef(
>             wsdlLocation =
> "http://127.0.0.1:4204/CategoryManagerImpl?wsdl";
>     )
>     private CategoryWebService categoryWs;
> 
>     //START SNIPPET: setup    
>     private InitialContext initialContext;
> public void testCategoryManagerViaRemoteInterface() throws Exception {
>         CategoryManagerLocal cat = (CategoryManagerLocal)
> initialContext.lookup("CategoryManagerImplLocal");
>         assertEquals(2, cat.add(1, 1));
>     }
> 

CategoryManagerLocal.java:



> package org.superbiz.calculator;
> 
> import ix.houseware.category.service.CategorySubcategories;
> import java.util.Collection;
> import javax.ejb.Local;
> 
> /**
>  *
>  * @author sam
>  */
> @Local
> public interface CategoryManagerLocal {
>     Collection<CategorySubcategories> findAll();
>     Collection<CategorySubcategories> find(final String name, final String
> desc);
>     int add(int a, int b);
> }
> 
> 

CategoryManagerImpl.java :



> @Stateless
> //@LocalBean
> public class CategoryManagerImpl implements CategoryManagerLocal {
> //    @WebServiceRef(wsdlLocation =
> "META-INF/wsdl/www.ixsystems.com.au/category-ws-0.0.1-SNAPSHOT/services.wsdl")
>     @WebServiceRef(wsdlLocation =
> "http://www.ixsystems.com.au/category-ws-0.0.1-SNAPSHOT/services?wsdl";)
>     private CategoryWebService_Service service; 
> @Override
>             public int add(int a, int b) {
>                 return a+b;
>     }
> }
> 

CategoryWebService_Service.java:



> @WebServiceClient(name = "CategoryWebService", targetNamespace =
> "http://service.category.houseware.ix/";, wsdlLocation =
> "http://www.ixsystems.com.au/category-ws-0.0.1-SNAPSHOT/services?wsdl";)
> public class CategoryWebService_Service
>     extends Service
> {
>  static {
>         URL url = null;
>         try {
>             URL baseUrl;
>             baseUrl =
> ix.houseware.category.service.CategoryWebService_Service.class.getResource(".");
>             url = new URL(baseUrl,
> "http://www.ixsystems.com.au/category-ws-0.0.1-SNAPSHOT/services?wsdl";);
>         } catch (MalformedURLException e) {
>             logger.warning("Failed to create URL for the wsdl Location:
> 'http://www.ixsystems.com.au/category-ws-0.0.1-SNAPSHOT/services?wsdl',
> retrying as a local file");
>             logger.warning(e.getMessage());
>         }
>         CATEGORYWEBSERVICE_WSDL_LOCATION = url;
>     }
> 
>     public CategoryWebService_Service(URL wsdlLocation, QName serviceName)
> {
>         super(wsdlLocation, serviceName);
>     }
> 
>     public CategoryWebService_Service() {
>         super(CATEGORYWEBSERVICE_WSDL_LOCATION, new
> QName("http://service.category.houseware.ix/";, "CategoryWebService"));
>     }
> @WebEndpoint(name = "CategoryWebServiceImplPort")
>     public CategoryWebService getCategoryWebServiceImplPort() {
>         return super.getPort(new
> QName("http://service.category.houseware.ix/";,
> "CategoryWebServiceImplPort"), CategoryWebService.class);
>     }
>  @WebEndpoint(name = "CategoryWebServiceImplPort")
>     public CategoryWebService
> getCategoryWebServiceImplPort(WebServiceFeature... features) {
>         return super.getPort(new
> QName("http://service.category.houseware.ix/";,
> "CategoryWebServiceImplPort"), CategoryWebService.class, features);
>     }
> }
> 

Very appreciate for any further suggestion.

Thanks
Sam

--
View this message in context: 
http://openejb.979440.n4.nabble.com/Can-t-invoke-web-service-tp3804670p3807571.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to