You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by drere <in...@drere.de> on 2008/04/28 17:15:40 UTC

CXF Client-Provider-Test

Hi,

i want to test following example

file-component --> cfx-provider-component --> cfx-consumer-component

I've found some examples here. But nothing works. Here are my xbeans:

file-component:
<beans xmlns:file="http://servicemix.apache.org/file/1.0"
       xmlns:hallo="http://webservice.mms_dresden.de">

  <file:poller service="hallo:cxfFile" 
             endpoint="poller"
             file="file:D:/Drere/test/out" 
             targetService="hallo:HalloService"
             targetEndpoint="HalloProxy"/>  
</beans>

cfx-provider-component:
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:hallo="http://webservice.mms_dresden.de"
       xmlns:soap="http://servicemix.apache.org/soap/1.0">

      <cxfbc:provider service="hallo:HalloService"
                      endpoint="HalloProxy"
                      wsdl="classpath:hallo.wsdl"
                      locationURI="http://localhost:8092/HalloService/"
                      useJBIWrapper="false">
      </cxfbc:provider>   
</beans>

cfx-consumer-component:
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:hallo="http://webservice.mms_dresden.de"
       xmlns:soap="http://servicemix.apache.org/soap/1.0">
  
  <cxfbc:consumer wsdl="classpath:hallo.wsdl"
                      timeout="999999"
                      useJBIWrapper="false"
                      targetEndpoint="HalloProxy"
                      targetService="hallo:HalloService">    
  </cxfbc:consumer>   
</beans>

cxf-se:
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0">

    <cxfse:endpoint useJBIWrapper="false">
        <cxfse:pojo>
          <bean class="de.mms_dresden.webservice.HalloImpl" >
          </bean>
        </cxfse:pojo>
    </cxfse:endpoint>

</beans>

wsdl:
<?xml version="1.0" encoding="UTF-8"?>
	<!-- Das ist ein Testkommentar. Wenn der erscheint, wurde die WSDL nicht
generiert! -->
<wsdl:definitions name="hallo"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tns="http://webservice.mms_dresden.de"
	xmlns:typens="http://webservice.mms_dresden.de"
	targetNamespace="http://webservice.mms_dresden.de" 
  xmlns:p="http://schemas.xmlsoap.org/wsdl/http/">
	
	<wsdl:types>
		<xsd:schema targetNamespace="http://webservice.mms_dresden.de"
		            elementFormDefault="qualified">
		            
			<xsd:element name="SayHallo">
			  <xsd:complexType>
					<xsd:sequence>
						<xsd:element name="who" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="SayHalloResponse">
			  <xsd:complexType>
					<xsd:sequence>
					    <xsd:element name="who" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:schema>
  </wsdl:types>
	
	<wsdl:message name="SayHalloRequest">
		<wsdl:part name="payload" element="typens:SayHallo"/>
	</wsdl:message>
	<wsdl:message name="SayHalloResponse">
		<wsdl:part name="payload" element="typens:SayHalloResponse"/>
	</wsdl:message>

  <wsdl:portType name="Hallo">
		<wsdl:operation name="SayHallo">
			<wsdl:input message="tns:SayHalloRequest"/>
			<wsdl:output message="tns:SayHalloResponse"/>
		</wsdl:operation>
	</wsdl:portType>
	
    <wsdl:binding name="HalloSOAPBinding" type="tns:Hallo">
    	<soap:binding style="document"
    		transport="http://schemas.xmlsoap.org/soap/http" />
    	<wsdl:operation name="SayHallo">
    	<soap:operation
soapAction="http://webservice.mms_dresden.de/sayHallo"/>
    		<wsdl:input>
    			<soap:body use="literal" />
    		</wsdl:input>
    		<wsdl:output>
    			<soap:body use="literal" />
    		</wsdl:output>
    	</wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="HalloService">
    	<wsdl:port binding="tns:HalloSOAPBinding" name="Hallo">
           <soap:address location="http://0.0.0.0:8092/HalloService/" />
       </wsdl:port>
   </wsdl:service>

</wsdl:definitions>

I get following exception:
ERROR - CxfBcComponent                 - Error processing exchange InOnly[
  id: ID:164.20.15.122-119959725cc-8:0
  status: Active
  role: provider
  service: {http://webservice.mms_dresden.de}HalloService
  endpoint: HalloProxy
  in: Unable to display: java.io.IOException: Stream closed
]
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
        at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:659)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:957)

What is the mistake??

Andrea


-- 
View this message in context: http://www.nabble.com/CXF-Client-Provider-Test-tp16941151p16941151.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: CXF Client-Provider-Test and Signature

Posted by drere <in...@drere.de>.
Hi Freeman,

thanks for this information.

One last question: Do you know the problem, i described in the attachment of
my last post? Is this a bug? I would use also the http-component in so far
the signing would work.

Andrea
-- 
View this message in context: http://www.nabble.com/CXF-Client-Provider-Test-tp16941151p16959974.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: CXF Client-Provider-Test and Signature

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
If you want to use signatures for your webservice, you can use cxf bc 
provider configured with WSS4J interceptors and saaj interceptors.

Your cxf provider should be

<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:hallo="http://webservice.mms_dresden.de"
       xmlns:soap="http://servicemix.apache.org/soap/1.0">

      <cxfbc:provider service="hallo:HalloService"
                      endpoint="HalloProxy"
                      wsdl="classpath:hallo.wsdl"
                      locationURI="http://localhost:8092/HalloService/"
                      useJBIWrapper="false">
         <cxfbc:outInterceptors>
          <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          <bean calss="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
          <ref bean="SignEncrypt_Request"/>
        </cxfbc:outInterceptors>
     
      </cxfbc:provider>   
      <bean
        class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"
        id="SignEncrypt_Request">
        <constructor-arg>
            <map>
                <entry key="action" value="Signature"/>
                <entry key="user" value="..."/>
                <entry key="signaturePropFile" value="..."/>
            </map>
        </constructor-arg>
    </bean>

</beans>

A example of signaturePropFile looks like

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=password
org.apache.ws.security.crypto.merlin.keystore.alias=alice
org.apache.ws.security.crypto.merlin.file=src/test/resources/org/apache/servicemix/cxfbc/ws/security/alice.jks

Regards

Freeman

[1] for more details how ws-security is supported in cxf

[1]http://cwiki.apache.org/CXF20DOC/ws-security.html

drere wrote:
> Hi Freeman,
>
> it seems that i misunderstood the use of some cxf-components. At first i
> tested the example with http-consumer and provider and on the way i
> explained at first post, the example works with http-components. It appears
> that the use of cxf-components is a little bit different according to
> http-components.
>
> The real goal of my tests is to use signatures for my webservices. There
> were some problems by using signatures in http-component and i tried to post
> this problem to this mailing list. But everytime my message was rejected by
> the mailing list, because it was categorized as spam. 
>
> I could append  http://www.nabble.com/file/p16953725/forum-post.txt the
> original signature-question  as file and hope, the post will not be rejected
> again.
>   


Re: CXF Client-Provider-Test and Signature

Posted by drere <in...@drere.de>.
Hi Freeman,

it seems that i misunderstood the use of some cxf-components. At first i
tested the example with http-consumer and provider and on the way i
explained at first post, the example works with http-components. It appears
that the use of cxf-components is a little bit different according to
http-components.

The real goal of my tests is to use signatures for my webservices. There
were some problems by using signatures in http-component and i tried to post
this problem to this mailing list. But everytime my message was rejected by
the mailing list, because it was categorized as spam. 

I could append  http://www.nabble.com/file/p16953725/forum-post.txt the
original signature-question  as file and hope, the post will not be rejected
again.
-- 
View this message in context: http://www.nabble.com/CXF-Client-Provider-Test-tp16941151p16953725.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: CXF Client-Provider-Test

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
 From your configuration,  your cxf provider try to connect the uri your 
cxf consumer listening on, that's not correct.
Generally the provider connect external service outside servicemix and 
consumer handle external request.
The workflow you showed here confused me, would you explain more?

Regards
Freeman

drere wrote:
> Hi,
>
> i want to test following example
>
> file-component --> cfx-provider-component --> cfx-consumer-component
>
> I've found some examples here. But nothing works. Here are my xbeans:
>
> file-component:
> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
>        xmlns:hallo="http://webservice.mms_dresden.de">
>
>   <file:poller service="hallo:cxfFile" 
>              endpoint="poller"
>              file="file:D:/Drere/test/out" 
>              targetService="hallo:HalloService"
>              targetEndpoint="HalloProxy"/>  
> </beans>
>
> cfx-provider-component:
> <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>        xmlns:hallo="http://webservice.mms_dresden.de"
>        xmlns:soap="http://servicemix.apache.org/soap/1.0">
>
>       <cxfbc:provider service="hallo:HalloService"
>                       endpoint="HalloProxy"
>                       wsdl="classpath:hallo.wsdl"
>                       locationURI="http://localhost:8092/HalloService/"
>                       useJBIWrapper="false">
>       </cxfbc:provider>   
> </beans>
>
> cfx-consumer-component:
> <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>        xmlns:hallo="http://webservice.mms_dresden.de"
>        xmlns:soap="http://servicemix.apache.org/soap/1.0">
>   
>   <cxfbc:consumer wsdl="classpath:hallo.wsdl"
>                       timeout="999999"
>                       useJBIWrapper="false"
>                       targetEndpoint="HalloProxy"
>                       targetService="hallo:HalloService">    
>   </cxfbc:consumer>   
> </beans>
>
> cxf-se:
> <beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0">
>
>     <cxfse:endpoint useJBIWrapper="false">
>         <cxfse:pojo>
>           <bean class="de.mms_dresden.webservice.HalloImpl" >
>           </bean>
>         </cxfse:pojo>
>     </cxfse:endpoint>
>
> </beans>
>
> wsdl:
> <?xml version="1.0" encoding="UTF-8"?>
> 	<!-- Das ist ein Testkommentar. Wenn der erscheint, wurde die WSDL nicht
> generiert! -->
> <wsdl:definitions name="hallo"
> 	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> 	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:tns="http://webservice.mms_dresden.de"
> 	xmlns:typens="http://webservice.mms_dresden.de"
> 	targetNamespace="http://webservice.mms_dresden.de" 
>   xmlns:p="http://schemas.xmlsoap.org/wsdl/http/">
> 	
> 	<wsdl:types>
> 		<xsd:schema targetNamespace="http://webservice.mms_dresden.de"
> 		            elementFormDefault="qualified">
> 		            
> 			<xsd:element name="SayHallo">
> 			  <xsd:complexType>
> 					<xsd:sequence>
> 						<xsd:element name="who" type="xsd:string"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> 			<xsd:element name="SayHalloResponse">
> 			  <xsd:complexType>
> 					<xsd:sequence>
> 					    <xsd:element name="who" type="xsd:string"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> 		</xsd:schema>
>   </wsdl:types>
> 	
> 	<wsdl:message name="SayHalloRequest">
> 		<wsdl:part name="payload" element="typens:SayHallo"/>
> 	</wsdl:message>
> 	<wsdl:message name="SayHalloResponse">
> 		<wsdl:part name="payload" element="typens:SayHalloResponse"/>
> 	</wsdl:message>
>
>   <wsdl:portType name="Hallo">
> 		<wsdl:operation name="SayHallo">
> 			<wsdl:input message="tns:SayHalloRequest"/>
> 			<wsdl:output message="tns:SayHalloResponse"/>
> 		</wsdl:operation>
> 	</wsdl:portType>
> 	
>     <wsdl:binding name="HalloSOAPBinding" type="tns:Hallo">
>     	<soap:binding style="document"
>     		transport="http://schemas.xmlsoap.org/soap/http" />
>     	<wsdl:operation name="SayHallo">
>     	<soap:operation
> soapAction="http://webservice.mms_dresden.de/sayHallo"/>
>     		<wsdl:input>
>     			<soap:body use="literal" />
>     		</wsdl:input>
>     		<wsdl:output>
>     			<soap:body use="literal" />
>     		</wsdl:output>
>     	</wsdl:operation>
>     </wsdl:binding>
>
>     <wsdl:service name="HalloService">
>     	<wsdl:port binding="tns:HalloSOAPBinding" name="Hallo">
>            <soap:address location="http://0.0.0.0:8092/HalloService/" />
>        </wsdl:port>
>    </wsdl:service>
>
> </wsdl:definitions>
>
> I get following exception:
> ERROR - CxfBcComponent                 - Error processing exchange InOnly[
>   id: ID:164.20.15.122-119959725cc-8:0
>   status: Active
>   role: provider
>   service: {http://webservice.mms_dresden.de}HalloService
>   endpoint: HalloProxy
>   in: Unable to display: java.io.IOException: Stream closed
> ]
> java.net.SocketTimeoutException: Read timed out
>         at java.net.SocketInputStream.socketRead0(Native Method)
>         at java.net.SocketInputStream.read(SocketInputStream.java:129)
>         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
>         at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
>         at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
>         at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:659)
>         at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
>         at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
> nection.java:957)
>
> What is the mistake??
>
> Andrea
>
>
>