You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dom Voice <do...@gmail.com> on 2010/06/04 06:17:38 UTC

Re: JaxWsProxyFactoryBean Could not find definition for service



Thank you very much 
This solution were help me to put my move further.:-)


plester3738 wrote:
> 
> Thank you! I've been looking at that all day and didn't see that I had put
> in a parenthesis  instead of the brace. That solved that problem. Now I'm
> on the next!
> 
> Thanks much!
> 
> Paul
> 
> 
> 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.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:312)
>> 	at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:408)
>> 	at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:189)
>> 	at
>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:164)
>> 	at
>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
>> 	at
>> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
>> 	at
>> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
>> 	at
>> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java: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/JMBLWebService.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}JMBLWebServiceSoapPortType"));
>>             
>>             
>>             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!
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JaxWsProxyFactoryBean-Could-not-find-definition-for-service-tp20774826p28775579.html
Sent from the cxf-user mailing list archive at Nabble.com.