You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "angel.ortiz" <ao...@gmail.com> on 2009/07/27 20:11:42 UTC

Invoking an external Web Service with CXF-BC

Hi everyone,

I'm new to ServiceMix. I'm trying to invoke an external Web Service via a
CXF BC (provider) with Servicemix 3.3.1. However, I haven't been able to
make it work. The logs doesn't show anything at all (no error or success
messages).

I know the Web Service is not being reached because there's no SOAP response
and my WS doesn't insert a database record (which is part of its work).

What I have figured so far:

    * wsdl refers to classpath:path/to/wsdl/file or http://path/to/wsdl/file
    * service refers to <ws...@name>
    * endpoint refers to <se...@name>
    * interfaceName corresponds to <ws...@name>

Is this correct?

This is the code of my provider service unit:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:odews="http://efs.comfin.ge.com/ws/ode_wf/service"
xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
servicemix-cxf-bc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<cxfbc:provider wsdl="classpath:ode_wf_ext.wsdl"
service="odews:ode_wf_ext"
endpoint="ode_wf_extSOAP"
interfaceName="odews:ode_wf_ext"
locationURI="http://dev.efs.comfin.ge.com:80/axis2/services/ode_wf_ext/"
synchronous="true"
useJBIWrapper="true">

<cxfbc:inFaultInterceptors>
<bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
</cxfbc:inFaultInterceptors>

<cxfbc:inInterceptors>
<bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
</cxfbc:inInterceptors>

<cxfbc:outFaultInterceptors>
<bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
</cxfbc:outFaultInterceptors>

<cxfbc:outInterceptors>
<bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
</cxfbc:outInterceptors>

</cxfbc:provider>

</beans>

And the WSDL of my web service:

<wsdl:definitions name="ode_wf_ext"
targetNamespace="http://efs.comfin.ge.com/ws/ode_wf/service"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://efs.comfin.ge.com/ws/ode_wf/service"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

</wsdl:binding>
...
<wsdl:operation name="send_email">
<soap:operation
soapAction="http://efs.comfin.ge.com/ws/ode_wf/service/send_email" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ode_wf_ext">
<wsdl:port name="ode_wf_extSOAP" binding="tns:ode_wf_extSOAP">
<soap:address
location="http://dev.efs.comfin.ge.com:80/axis2/services/ode_wf_ext/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

I have been struggling with this SU for quite a time... :( and I still don't
have a clue.

Any help will be appreciated.

Thanks,
Angel
-- 
View this message in context: http://www.nabble.com/Invoking-an-external-Web-Service-with-CXF-BC-tp24685630p24685630.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Invoking an external Web Service with CXF-BC

Posted by "angel.ortiz" <ao...@gmail.com>.

Hi Jean,

Thanks for your reply :)

I tried to remove the 'classpath:' prefix as you suggested. I had a couple
of FileNotFound exceptions... I had to keep it. The other values were just
fine.

I have changed my bc configuration, now it throws an exception:

+---------------------------CONSOLE LOG--------------------------------+
*** Received exchange: InOnly[
  id: ID:3.211.67.14-122c1bc8ee1-7:1
  status: Active
  role: provider
  service: {http://my.company/servicemix/mail-poller}console-logger
  endpoint: logger
  in: Unable to display: org.xml.sax.SAXParseException: Content is not
allowed in prolog.
]
+----------------------------------------------------------------------+
[Fatal Error] :1:1: Content is not allowed in prolog.

>>> Starting e-mail content filter (JSR-223)
>>> Input message: [**TESTNUMBERONE**
]
KEY: 	TESTNUMBERONE
Approve:  	true
Reject:  	false
Sender email: 	angel.ortiz@localhost
Sender SSO: 	PENDING
+Step 2
****************************************************************
+SOAP REQUEST: StringSource[<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://efs.comfin.mycompany.com/ws/ode_wf/service">
<soapenv:Header/><soapenv:Body><ser:send_email><to>diaz.luis@mycompany.com</to><from>angel.ortiz@localhost</from><cc>angel.ortiz@mycompany.com</cc><subject>Your
request has been processed.</subject><body>Action requested = Approve, Key =
TESTNUMBERONE, Sender =
angel.ortiz@localhost</body><process_id>Approved</process_id><approval_key>TESTNUMBERONE</approval_key></ser:send_email></soapenv:Body></soapenv:Envelope>]
****************************************************************
>>> End of message processing
C: RSET
S: +OK
C: DELE 1
S: +OK Message deleted
C: QUIT
S: +OK Apache James POP3 Server signing off.
ERROR - CxfBcComponent                 - Error processing exchange InOnly[
  id: ID:3.211.67.14-122c1bc8ee1-19:0
  status: Active
  role: provider
  service: {http://efs.comfin.mycompany.com/ws/ode_wf/service}ode_wf_ext
  endpoint: ode_wf_extSOAP
  in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://my.company/ws/ode_wf/service">
<soapenv:Header/><soapenv:Body><ser:send_email><to>diaz.luis@mycompany.com</to><from>angel.ortiz@localhost</from><cc>angel.ortiz@mycompany.com</cc><subject>Your
request has been processed.</subject><body>Action requested = Approve, Key =
TESTNUMBERONE, Sender =
angel.ortiz@localhost</body><process_id>Approved</process_id><approval_key>TESTNUMBERONE</approval_key></ser:send_email></soapenv:Body></soapenv:Envelope>
]
java.lang.NullPointerException
	at
org.apache.servicemix.cxfbc.CxfBcProvider.findOperation(CxfBcProvider.java:546)
	at
org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:193)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
	at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:595)


My CXF BC looks like:

<cxfbc:provider wsdl="classpath:ode_wf_ext.wsdl" 
		service="odews:ode_wf_ext"
		endpoint="ode_wf_extSOAP"
		locationURI="http://dev.efs.comfin.ge.com:80/axis2/services/ode_wf_ext/"
		interfaceName="odews:ode_wf_ext"
		synchronous="true"
		useJBIWrapper="true">

		 ...

</cxfbc:provider>

Any ideas on this one?

Thanks,
Angel
-- 
View this message in context: http://www.nabble.com/Invoking-an-external-Web-Service-with-CXF-BC-tp24685630p24699264.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Invoking an external Web Service with CXF-BC

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Angel,

could we have the log file ?

My comments inline:

>     * wsdl refers to classpath:path/to/wsdl/file or http://path/to/wsdl/file
The wsdl property is looked into the classpath. Basicly, you don't need 
the classpath: prefix.
If you use /ode_wf_ext.wsdl, you need to add the jar/resources 
containing the WSDL into your CXF SU. To do it, in the xbean.xml, you 
can use 
<classpath><location>my_wsdl.jar</location><location>/path/to/wsdl/rep</location></classpath>
>     * service refers to <ws...@name>
>     * endpoint refers to <se...@name>
>     * interfaceName corresponds to <ws...@name>
You need to ensure that the service name and endpoint match the service 
and port elements of the WSDL that you wish to use to correctly return 
WSDL for the endpoint,  remembering that the service name will use the 
targetNamespace for the WSDL.

I hope it helps you.

Regards
JB

> 
> Is this correct?
> 
> This is the code of my provider service unit:
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
> xmlns:odews="http://efs.comfin.ge.com/ws/ode_wf/service"
> xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
> servicemix-cxf-bc.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
> 
> <cxfbc:provider wsdl="classpath:ode_wf_ext.wsdl"
> service="odews:ode_wf_ext"
> endpoint="ode_wf_extSOAP"
> interfaceName="odews:ode_wf_ext"
> locationURI="http://dev.efs.comfin.ge.com:80/axis2/services/ode_wf_ext/"
> synchronous="true"
> useJBIWrapper="true">
> 
> <cxfbc:inFaultInterceptors>
> <bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
> </cxfbc:inFaultInterceptors>
> 
> <cxfbc:inInterceptors>
> <bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
> </cxfbc:inInterceptors>
> 
> <cxfbc:outFaultInterceptors>
> <bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
> </cxfbc:outFaultInterceptors>
> 
> <cxfbc:outInterceptors>
> <bean class="com.ge.efs.servicemix.mailpoller.MailWSInterceptor" />
> </cxfbc:outInterceptors>
> 
> </cxfbc:provider>
> 
> </beans>
> 
> And the WSDL of my web service:
> 
> <wsdl:definitions name="ode_wf_ext"
> targetNamespace="http://efs.comfin.ge.com/ws/ode_wf/service"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://efs.comfin.ge.com/ws/ode_wf/service"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
> 
> </wsdl:binding>
> ...
> <wsdl:operation name="send_email">
> <soap:operation
> soapAction="http://efs.comfin.ge.com/ws/ode_wf/service/send_email" />
> <wsdl:input>
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="ode_wf_ext">
> <wsdl:port name="ode_wf_extSOAP" binding="tns:ode_wf_extSOAP">
> <soap:address
> location="http://dev.efs.comfin.ge.com:80/axis2/services/ode_wf_ext/" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> 
> I have been struggling with this SU for quite a time... :( and I still don't
> have a clue.
> 
> Any help will be appreciated.
> 
> Thanks,
> Angel

-- 
Jean-Baptiste Onofré
---------------------------------
  HomePage
http://www.nanthrax.net
---------------------------------
  Contacts
jbonofre@apache.org
jb@nanthrax.net
---------------------------------
  OpenSource
BuildProcess/AutoDeploy
http://buildprocess.sourceforge.net
Apache ServiceMix
http://servicemix.apache.org
-----------------------------------
PGP : 17D4F086