cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: JaxWsProxyFactoryBean Could not find definition for service
Date Mon, 01 Dec 2008 21:44:01 GMT

Should the line:

factory.setServiceName(QName.valueOf("(urn:metoc:jmcbl:jmbl)JMBLWebService"))
be:
factory.setServiceName(QName.valueOf("{urn:metoc:jmcbl:jmbl}JMBLWebService"))
or:
factory.setServiceName(new QName("urn:metoc:jmcbl:jmbl", "JMBLWebService"))

Dan


On Monday 01 December 2008 2:03:13 pm plester3738 wrote:
> I'm to establish a connection with a web service located at :
> https://metocdata.afwa.af.mil/JMBLWeb/jmbl/JMBLWebService.jws
>
> I have downloaded the WSDL to my local machine, and it is in the classpath;
> however, I get the following exception when I try to connect to the
> service:
>
> org.apache.cxf.service.factory.ServiceConstructionException: Could not find
> definition for service (urn:metoc:jmcbl:jmbl)JMBLWebService.
> 	at
> org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114
>) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFro
>mWSDL(ReflectionServiceFactoryBean.java:312) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServi
>ceModel(ReflectionServiceFactoryBean.java:408) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Reflecti
>onServiceFactoryBean.java:189) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFac
>toryBean.java:164) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(Abs
>tractWSDLBasedEndpointFactory.java:100) at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
> 	at
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBea
>n.java:102) at
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.jav
>a:115) at test.GeneralUMOTest.cxfTest(GeneralUMOTest.java:61)
> 	at test.GeneralUMOTest.main(GeneralUMOTest.java:112)
>
> Here is the WSDL, with the XSD excluded:
> 		<xs:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified" targetNamespace="urn:metoc:jmcbl:jmbl"
> xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="urn:metoc:jmcbl:jmbl"
> xmlns:s2="urn:metoc:jmbl:wsdl"
> xmlns:s3="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
> 	</s0:types>
> 	<s0:message name="getMETOCRequest">
> 		<s0:part name="aRequestList" element="s1:RequestList"/>
> 	</s0:message>
> 	<s0:message name="getMETOCRequestResponse">
> 		<s0:part name="ResponseList" element="s1:ResponseList"/>
> 	</s0:message>
> 	<s0:portType name="JMBLWebServiceSoapPortType">
> 		<s0:operation name="getMETOCRequest" parameterOrder="aRequestList">
> 			<s0:input message="s2:getMETOCRequest"/>
> 			<s0:output message="s2:getMETOCRequestResponse"/>
> 		</s0:operation>
> 	</s0:portType>
> 	<s0:binding name="JMBLWebServiceSoapBinding"
> type="s2:JMBLWebServiceSoapPortType">
> 		<s3:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> 		<s0:operation name="getMETOCRequest">
> 			<s3:operation soapAction="" style="document"/>
> 			<s0:input>
> 				<s3:body parts="aRequestList" use="literal"/>
> 			</s0:input>
> 			<s0:output>
> 				<s3:body parts="ResponseList" use="literal"/>
> 			</s0:output>
> 		</s0:operation>
> 	</s0:binding>
> 	<s0:service name="JMBLWebService">
> 		<s0:port name="JMBLWebServicePort"
> binding="s2:JMBLWebServiceSoapBinding"> <s3:address
> location="http://apps0101p:80/JMBLWeb/jmbl/JMBLWebService.jws"/>
> 		</s0:port>
> 	</s0:service>
>
>
> What am I missing???
>
> I'm using the following code:
>             JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>             // These interceptors will output soap-payloads to the system
>             // console and and are VERY useful for debugging.
>             factory.getInInterceptors().add(new LoggingInInterceptor());
>             factory.getOutInterceptors().add(new LoggingOutInterceptor());
>
>             // This is where you define the **interface** service class
>             factory.setServiceClass(JMBLWebService.class);
>             // The endpoint of which you are trying to connect to.
>
> factory.setAddress("https://metocdata.afwa.af.mil/JMBLWeb/jmbl/JMBLWebServi
>ce.jws"); // Most likely (especially via https) you have downloaded // the
> remote WSDL file to your machine.  This file must // either be on your
> classpath and/or you must supply the // aboslute path name (which then you
> would use file:  instead // of classpath: )
>             factory.setWsdlURL("classpath:resources/JMBLWebService.wsdl");
>             // Specify using the following format -->
> {targetNamespace}ServiceName
>
> factory.setServiceName(QName.valueOf("(urn:metoc:jmcbl:jmbl)JMBLWebService"
>)); // Specify using the following format -->
> {targetNamespace}ServicePortType
>
> factory.setEndpointName(QName.valueOf("{urn:metoc:jmcbl:jmbl}JMBLWebService
>SoapPortType"));
>
>
>             System.out.println("Connecting to server: " +
> factory.getAddress());
>             // This instantiates the remote-client object.
>             JMBLWebService general = (JMBLWebService)factory.create(); <--
> Exception happens here!
>
>             // Establishing the SSL sessiona and providing the keystore
>             // and truststore associated with this connection.
>             // Notice that getClient() is using the object defined above.
>             Client client = ClientProxy.getClient(general);
>             HTTPConduit conduit = (HTTPConduit) client.getConduit();
>             TLSClientParametersType tlsConfig = new
> TLSClientParametersType();
>             // You would normally omit the line below.  It is set for
> ignoring
>             // the remote hostname and the hostname defined in the server
> certificate.
>             // If they are NOT the same, then the connection would not
> establish.  As
>             // this is what you would want in a real production
> environment. tlsConfig.setDisableCNCheck(true);
>             tlsConfig.setSecureSocketProtocol("SSL");
>
>             // KEYSTORE
>             KeyManagersType keyManagersType = new KeyManagersType();
>             KeyStoreType keyStoreType = new KeyStoreType();
>
> keyStoreType.setFile(ClassLoader.getSystemResource("resources/MetocCA.jks")
>.getFile()); keyStoreType.setType("JKS");
>             keyStoreType.setPassword("password");
>             keyManagersType.setKeyStore(keyStoreType);
>             keyManagersType.setKeyPassword("password");
>             tlsConfig.setKeyManagers(keyManagersType);
>
>             // TRUSTSTORE
>             TrustManagersType trustManagersType = new TrustManagersType();
>             KeyStoreType trustStoreType = new KeyStoreType();
>
> trustStoreType.setFile(ClassLoader.getSystemResource("resources/MetocCA.jks
>").getFile()); trustStoreType.setType("JKS");
>             trustStoreType.setPassword("password");
>             trustManagersType.setKeyStore(trustStoreType);
>             tlsConfig.setTrustManagers(trustManagersType);
>
>             TLSClientParametersConfig tlsconfig = new
> TLSClientParametersConfig(tlsConfig);
>             conduit.setTlsClientParameters(tlsconfig);
>
>             [snip...]
>
> Thanks, in advance, for your help!



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message