camel cxf consume service - soap

I have a very simple Soap service with a String parameter and returns a String.
With Maven I've generated the corresponding classes from the WSDL.
I imported the wsdl into SOAP-UI and I made a mock.
I started the mock and I made a test case which sends and receives the response correctly.
I created a junit test with a camel route
and that's where it comes problems.
I can't build the url that would allow me to invoke my mock
I first simply put "cxf://http://localhost:8088/mockws_traca?DefaultOperationName=MajTracaDMI&wsdlURL=ws_traca.wsdl"
without success.
I added the service class
"&serviceClass="+WsTraca.class.getName()
which causes an invalid service error {http://localhost/ws_traca/wsdl/}WsTraca
after debug step by step I found the name of the generated service that I added
"&serviceName={http://localhost/ws_traca/wsdl/}ws_traca"
he made the same mistake with the type of port
I did not find a parameter to specify the type of port so I added its name
"&portName={http://localhost/ws_traca/wsdl/}ws_tracaSoapPort"
My routeBuilder
protected final RouteBuilder createRouteBuilder() throws Exception{
return new RouteBuilder() {
#Override
public void configure() throws Exception{
from("direct:start")
.setHeader(CxfConstants.OPERATION_NAME, constant("MajTracaDMI"))
.to("cxf://http://localhost:8088/mockws_traca"
+ "?serviceClass="+WsTraca.class.getName()
+ "&portName={http://localhost/ws_traca/wsdl/}ws_tracaSoapPort"
+ "&serviceName={http://localhost/ws_traca/wsdl/}ws_traca"
+ "&wsdlURL=ws_traca.wsdl"
);
}
};
}
the wsdl :
<?xml version='1.0' encoding='UTF-8' ?>
<!-- Generated 05/15/19 by Microsoft SOAP Toolkit WSDL File Generator, Version 3.00.1325.0 -->
<definitions
name='ws_traca'
targetNamespace='http://localhost/ws_traca/wsdl/'
xmlns:wsdlns='http://localhost/ws_traca/wsdl/'
xmlns:typens='http://localhost/ws_traca/type/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:stk='http://schemas.microsoft.com/soap-toolkit/wsdl-extension'
xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'
xmlns:ref='http://schemas.xmlsoap.org/ws/2002/04/reference/'
xmlns:content='http://schemas.xmlsoap.org/ws/2002/04/content-type/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<types>
<schema
targetNamespace='http://localhost/ws_traca/type/'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
elementFormDefault='qualified'>
<import namespace='http://schemas.xmlsoap.org/soap/encoding/'/>
<import namespace='http://schemas.xmlsoap.org/wsdl/'/>
<import namespace='http://schemas.xmlsoap.org/ws/2002/04/reference/'/>
<import namespace='http://schemas.xmlsoap.org/ws/2002/04/content-type/'/>
</schema>
</types>
<message name='ws_traca.MajTracaDMI'>
<part name='c_xml' type='xsd:string'/>
</message>
<message name='ws_traca.MajTracaDMIResponse'>
<part name='Result' type='xsd:string'/>
</message>
<message name='ws_traca.GetTracaDMI'>
<part name='c_xml' type='xsd:string'/>
</message>
<message name='ws_traca.GetTracaDMIResponse'>
<part name='Result' type='xsd:string'/>
</message>
<message name='ws_traca.Ping'>
<part name='c_chaine' type='xsd:string'/>
</message>
<message name='ws_traca.PingResponse'>
<part name='Result' type='xsd:string'/>
</message>
<message name='ws_traca.InfoDll'>
<part name='cXml' type='xsd:string'/>
</message>
<message name='ws_traca.InfoDllResponse'>
<part name='Result' type='xsd:string'/>
</message>
<portType name='ws_tracaSoapPort'>
<operation name='MajTracaDMI' parameterOrder='c_xml'>
<input message='wsdlns:ws_traca.MajTracaDMI'/>
<output message='wsdlns:ws_traca.MajTracaDMIResponse'/>
</operation>
<operation name='GetTracaDMI' parameterOrder='c_xml'>
<input message='wsdlns:ws_traca.GetTracaDMI'/>
<output message='wsdlns:ws_traca.GetTracaDMIResponse'/>
</operation>
<operation name='Ping' parameterOrder='c_chaine'>
<input message='wsdlns:ws_traca.Ping'/>
<output message='wsdlns:ws_traca.PingResponse'/>
</operation>
<operation name='InfoDll' parameterOrder='cXml'>
<input message='wsdlns:ws_traca.InfoDll'/>
<output message='wsdlns:ws_traca.InfoDllResponse'/>
</operation>
</portType>
<binding name='ws_tracaSoapBinding' type='wsdlns:ws_tracaSoapPort' >
<stk:binding preferredEncoding='UTF-8'/>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='MajTracaDMI'>
<soap:operation soapAction='http://localhost/ws_traca/action/ws_traca.MajTracaDMI'/>
<input>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='c_xml'/>
</input>
<output>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='Result'/>
</output>
</operation>
<operation name='GetTracaDMI'>
<soap:operation soapAction='http://localhost/ws_traca/action/ws_traca.GetTracaDMI'/>
<input>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='c_xml'/>
</input>
<output>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='Result'/>
</output>
</operation>
<operation name='Ping'>
<soap:operation soapAction='http://localhost/ws_traca/action/ws_traca.Ping'/>
<input>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='c_chaine'/>
</input>
<output>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='Result'/>
</output>
</operation>
<operation name='InfoDll'>
<soap:operation soapAction='http://localhost/ws_traca/action/ws_traca.InfoDll'/>
<input>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='cXml'/>
</input>
<output>
<soap:body
namespace='http://localhost/ws_traca/message/'
parts='Result'/>
</output>
</operation>
</binding>
<service name='ws_traca' >
<port name='ws_tracaSoapPort' binding='wsdlns:ws_tracaSoapBinding' >
<soap:address location='http://localhost/ws_trunk/ws_traca.WSDL'/>
</port>
</service>
</definitions>
I've now an error on WsTraca that not an interface
org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cxf://http://SAP5223897:8088/mockws_traca?portName=%7Bhttp%3A%2F%2Flocalhost%2Fws_traca%2Fwsdl%2F%7Dws_tracaSoapPort&serviceClass=localhost.ws_traca.wsdl.WsTraca&serviceName=%7Bhttp%3A%2F%2Flocalhost%2Fws_traca%2Fwsdl%2F%7Dws_traca&wsdlURL=ws_traca.wsdl]. Reason: java.lang.IllegalArgumentException: localhost.ws_traca.wsdl.WsTraca is not an interface
at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:380)
at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:107)
at org.apache.camel.impl.ProducerCache.startProducer(ProducerCache.java:138)
at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:163)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
at org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:444)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:982)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.DefaultChannel.doStart(DefaultChannel.java:149)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:82)
at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:920)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
at org.apache.camel.impl.RouteService.startChildService(RouteService.java:245)
at org.apache.camel.impl.RouteService.warmUp(RouteService.java:142)
at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1843)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1771)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1556)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1448)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)
at org.apache.camel.test.junit4.CamelTestSupport.startCamelContext(CamelTestSupport.java:344)
at org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:228)
at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.IllegalArgumentException: localhost.ws_traca.wsdl.WsTraca is not an interface
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:470)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:690)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:171)
at org.apache.camel.component.cxf.CxfEndpoint.createClient(CxfEndpoint.java:455)
at org.apache.camel.component.cxf.CxfProducer.<init>(CxfProducer.java:71)
at org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:153)
at org.apache.camel.impl.InterceptSendToEndpoint.createProducer(InterceptSendToEndpoint.java:93)
at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:376)
... 83 more

Related

Application service not found

I have created SOAP service in NetBeans 13 that starts on GlassFish server with minor warnings:
Tue Jan 31 16:54:05 EET 2023 : Security manager installed using the Basic server security policy.
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.apache.derby.drda.NetworkServerControl (file:/C:/java_test/AppServer/Glassfish/javadb/lib/derbynet.jar)
WARNING: Please consider reporting this to the maintainers of org.apache.derby.drda.NetworkServerControl
WARNING: System::setSecurityManager will be removed in a future release
Tue Jan 31 16:54:05 EET 2023 : Apache Derby Network Server - 10.15.2.0 - (1873585) started and ready to accept connections on port 1527
Service code:
package javaeetutorial.helloservice;
import javax.jws.WebService;
import javax.jws.WebMethod;
#WebService
public class Hello {
private final String message = "Hello, ";
public Hello() {
}
#WebMethod
public String sayHello(String name) {
return message + name + ".";
}
#WebMethod
public String sayHello2(String name) {
return message + name + ".";
}
}
I found WSDL file of this project in location \helloservice-war\target\generated-sources\wsdl\HelloService.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 2.3.3 git-revision#b4c5bb6. -->
<definitions targetNamespace="http://helloservice.javaeetutorial/" name="HelloService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:tns="http://helloservice.javaeetutorial/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<types>
<xsd:schema>
<xsd:import namespace="http://helloservice.javaeetutorial/" schemaLocation="HelloService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello2">
<part name="parameters" element="tns:sayHello2"/>
</message>
<message name="sayHello2Response">
<part name="parameters" element="tns:sayHello2Response"/>
</message>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="Hello">
<operation name="sayHello2">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Request" message="tns:sayHello2"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Response" message="tns:sayHello2Response"/>
</operation>
<operation name="sayHello">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello2">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
When I run project from IDE it opens browser on adrees http://localhost:8080/helloservice-war/HelloService?Tester . Browser window shows error 404-Not found
I feed WSDL to SOAPUI client and have changed service path REPLACE_WITH_ACTUAL_URL to http://localhost:8080/helloservice-war/HelloService . I called function sayHello, but got 404 error.
Where is my service located and how to call it's functions?
GlassFish console:

Simple WSDL error "The part '' has an invalid value '' defined for its element. Element declarations must refer to valid values defined in a schema"

I am trying to write a simple wsdl file that has a inline xsd. But I'm getting the below errors marked with '*' in wsdl file. I refered other Stack Overflow question, but none helped on this issue.I've just edited my xsd and wsdl file to include the namespaces in each for more details on the files. You may please note that this are files are I've created in my local machine.Below is my code.
xsd file:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/bookService" xmlns:tns="http://www.example.org/bookService" elementFormDefault="qualified">
<element name="BookServiceRequest"
type="tns:BookServiceRequestType">
</element>
<complexType name="BookServiceRequestType">
<sequence>
<element name="limit" type="int"></element>
</sequence>
</complexType>
<complexType name="BookServiceResponseType">
<sequence>
<element name="book" type="tns:BookType" maxOccurs="unbounded" minOccurs="0"></element>
</sequence>
</complexType>
<element name="BookServiceResponse"
type="tns:BookServiceResponseType">
</element>
<complexType name="BookType">
<sequence>
<element name="title" type="string" maxOccurs="1" minOccurs="1"></element>
<element name="author" type="string" maxOccurs="1" minOccurs="1"></element>
<element name="published" type="date" maxOccurs="1" minOccurs="1"></element>
</sequence>
</complexType>
</schema>
wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="bookService"
targetNamespace="http://www.example.org/bookService/" xmlns:tns="http://www.example.org/bookService/"
xmlns:wsdl="http://www.example.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/bookService/">
<xsd:import schemaLocation="../schema/bookService.xsd"
namespace="http://www.example.org/bookService/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="BookServiceRequest">
**<wsdl:part name="BookServiceRequest" element="tns:BookServiceRequest" />
</wsdl:message>**
<wsdl:message name="BookServiceResponse">
**<wsdl:part name="BookServiceResponse" element="tns:BookServiceResponse" />**
</wsdl:message>
<wsdl:portType name="BookServicePortType">
<wsdl:operation name="fetchBooks">
<wsdl:input name="BookServiceRequest" message="tns:BookServiceRequest" />
<wsdl:output name="BookServiceResponse" message="tns:BookServiceResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BookServiceBinding" type="tns:BookServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="fetchBooks">
<soap:operation style="document"
soapAction="http://www.example.org/bookService/fetchBooks" />
<wsdl:input name="BookServiceRequest">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="BookServiceResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BookService">
<wsdl:port name="BookServicePort" binding="tns:BookServiceBinding">
<soap:address location="/service/bookService" />
</wsdl:port>
</wsdl:service>

CXF JaxWs Endpoint fail with 'The given SOAPAction does not match an operation' when the action contains accents

I have an issue with SOAPAction that contains accents.
From a third-party WSDL, I have generated Java Classes using CXF wsdl2java plugin. Using the generated classes, I have developed a CXF-based client and server. The problem is that the server fail to get the client's request with the following error :
2014-06-19 11:45:08,423 [qtp1051344475-17] WARN - Interceptor for {http://simulator.be.connectors.cam/}RIBSOAPSoapImplService#{http://tempuri.org/}Opération_1 has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: The given SOAPAction http://tempuri.org/RIB_SOAP/Opération_1 does not match an operation.
at org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor$SoapActionInAttemptTwoInterceptor.handleMessage(SoapActionInInterceptor.java:188)
at org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor$SoapActionInAttemptTwoInterceptor.handleMessage(SoapActionInInterceptor.java:163)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at ...
The log of the request at the client side shows the correct value of the SOAPAction while the request at the server side shows the wrong value.
The request at the client side is :
2014-06-19 11:45:08,349 [main] INFO - Outbound Message
---------------------------
ID: 1
Address: http://localhost:17081/SIMULATOR/RIB/WS
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], Connection=[Keep-Alive], SOAPAction=["http://tempuri.org/RIB_SOAP/Opération_1"]}
Payload: <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:Opération_1 xmlns:ns2="http://Rib_InSchema" xmlns:ns3="http://tempuri.org/" xmlns:ns4="http://Rib_OutSchema">
<ns2:Root>
<RIB>1234567890</RIB>
</ns2:Root>
</ns3:Opération_1>
</soap:Body>
</soap:Envelope>
--------------------------------------
The request at the server side is :
2014-06-19 11:45:08,408 [qtp1051344475-17] INFO - Inbound Message
----------------------------
ID: 2
Address: http://localhost:17081/SIMULATOR/RIB/WS
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml; charset=UTF-8
Headers: {Accept=[*/*], Cache-Control=[no-cache], connection=[keep-alive], Content-Length=[339], content-type=[text/xml; charset=UTF-8], Host=[localhost:17081], Pragma=[no-cache], SOAPAction=["http://tempuri.org/RIB_SOAP/Opération_1"], User-Agent=[Apache CXF 2.7.10]}
Payload: <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:Opération_1 xmlns:ns2="http://Rib_InSchema" xmlns:ns3="http://tempuri.org/" xmlns:ns4="http://Rib_OutSchema">
<ns2:Root>
<RIB>1234567890</RIB>
</ns2:Root>
</ns3:Opération_1>
</soap:Body>
</soap:Envelope>
--------------------------------------
As you can see from the logs, the UTF-8 is the used encoding at all levels. However, for some reason, at the server side, the SOAPAction has been decoded using ISO-8859-1.
The used WSDL is :
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/"
xmlns:s1="http://Rib_InSchema" xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s2="http://Rib_OutSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly
"BTS, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=dab3109d17486051" published web service.
</wsdl:documentation>
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:import namespace="http://Rib_InSchema" />
<s:import namespace="http://Rib_OutSchema" />
<s:element name="Opération_1">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" ref="s1:Root" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Opération_1Response">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" ref="s2:Root" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="http://Rib_InSchema">
<s:element name="Root">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="RIB" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="http://Rib_OutSchema">
<s:element name="Root">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="NumCompte" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Nom" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Prenom" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Agence" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="AgenceAdresse" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="RIB" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="Opération_1SoapIn">
<wsdl:part name="parameters" element="tns:Opération_1" />
</wsdl:message>
<wsdl:message name="Opération_1SoapOut">
<wsdl:part name="parameters" element="tns:Opération_1Response" />
</wsdl:message>
<wsdl:portType name="RIB_SOAPSoap">
<wsdl:operation name="Opération_1">
<wsdl:input message="tns:Opération_1SoapIn" />
<wsdl:output message="tns:Opération_1SoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="RIB_SOAPSoap"
type="tns:RIB_SOAPSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Opération_1">
<soap:operation
soapAction="http://tempuri.org/RIB_SOAP/Opération_1"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="RIB_SOAPSoap12"
type="tns:RIB_SOAPSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Opération_1">
<soap12:operation
soapAction="http://tempuri.org/RIB_SOAP/Opération_1"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RIB_SOAP">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly
"BTS, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=dab3109d17486051" published web service.
</wsdl:documentation>
<wsdl:port name="RIB_SOAPSoap"
binding="tns:RIB_SOAPSoap">
<soap:address
location="http://localhost/BTS_Proxy/RIB_SOAP.asmx" />
</wsdl:port>
<wsdl:port name="RIB_SOAPSoap12"
binding="tns:RIB_SOAPSoap12">
<soap12:address
location="http://localhost/BTS_Proxy/RIB_SOAP.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Spring conf for the client:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
"
>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<http-conf:conduit name=".*">
<http-conf:client ConnectionTimeout="30000" ReceiveTimeout="30000" />
</http-conf:conduit>
<jaxws:client
id="ribWebServiceClient"
serviceClass="org.tempuri.RIBSOAPSoap"
address="${ws.rib.url}"
>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" >
<property name="prettyLogging" value="true" />
</bean>
</jaxws:features>
<jaxws:properties>
<entry key="exceptionMessageCauseEnabled" value="true" />
<entry key="faultStackTraceEnabled" value="true" />
</jaxws:properties>
</jaxws:client>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
</beans>
Spring conf for the server:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
"
>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<jaxws:endpoint
id="ribWebServiceEndPoint"
implementor="#ribWebService"
address="${ws.rib.url}"
>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" >
<property name="prettyLogging" value="true" />
</bean>
</jaxws:features>
<jaxws:properties>
<entry key="exceptionMessageCauseEnabled" value="true" />
<entry key="faultStackTraceEnabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
</beans>
According to the HTTP spec, all the HTTP headers are supposed to be ISO-8859-1. There is an separate spec for how to encode non-ISO-8859-1 characters into the header (https://www.rfc-editor.org/rfc/rfc2047) but I'm not sure if the HTTPUrlConnection object in the JDK supports that or not. I'm also not sure if other soap client would support it either.
I would strongly suggest making sure the SOAPAction values would be ISO-8859-1 compatible.
Please refer to this discussion in CXF Users Mainling List. As mentioned by Aki, HTTP Specs requires that HTTP Headers use only US-ASCII characters (see rfc2822). And as mentioned by Daniel and Aki, the spec rfc2047 should be used in case there is a need to use a none US-ASCII character.
The solution for this issue is to avoid using characters that are not US-ASCII characters (include accented characters of course).

java.lang.Exception: No such operation: login j

I'm trying to invoke sfdc login webservice from mule. I generated classes using apache cxxf wsdl2java on partner wsdl. I tried all possible ways of sending the input,but still continue to get the "java.lang.Exception: No such operation: login" error
Following is my flow:
<mule....>
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/>
<flow name="mainFlow1" doc:name="mainFlow1">
<http:inbound-endpoint exchange-pattern="request-response" path="sfdclogin" host="localhost" port="8081" doc:name="HTTP"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[import com.sforce.soap.partner.*;
ObjectFactory of= new ObjectFactory();
com.sforce.soap.partner.Login loginReq=new com.sforce.soap.partner.Login();
loginReq.setUsername("username");
loginReq.setPassword("password");
return loginReq;]]></scripting:script>
</scripting:component>
<cxf:jaxws-client operation="login" serviceClass="com.sforce.soap.partner.SforceService" doc:name="SOAP"/>
<https:outbound-endpoint address="https://test.salesforce.com/services/Soap/u/30.0" exchange-pattern="request-response" method="POST" doc:name="HTTPS"/>
</flow>
</mule>
Exception stack trace. As can be seen below, correct object of Login type is being passed to SOAP component.
Object after transform: com.sforce.soap.partner.Login#5d9683ed
The transformed object is of expected type. Type is: Login
********************************************************************************
Message : No such operation: login. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: Login
Type : org.mule.api.transport.DispatchException
Code : MULE_ERROR--2
Payload : com.sforce.soap.partner.Login#5d9683ed
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html
********************************************************************************
Exception stack is:
1. No such operation: login (java.lang.Exception)
org.mule.module.cxf.CxfOutboundMessageProcessor:282 (null)
2. No such operation: login. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: Login (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
********************************************************************************
Root Exception stack trace:
java.lang.Exception: No such operation: login
at org.mule.module.cxf.CxfOutboundMessageProcessor.getOperation(CxfOutboundMessageProcessor.java:282)
at org.mule.module.cxf.CxfOutboundMessageProcessor.getOperation(CxfOutboundMessageProcessor.java:363)
WSDL:
<!-- Login Message Types -->
<element name="login">
<complexType>
<sequence>
<element name="username" type="xsd:string"/>
<element name="password" type="xsd:string"/>
</sequence>
</complexType>
</element>
<message name="loginRequest">
<part element="tns:login" name="parameters"/>
</message>
<!-- Soap PortType -->
<portType name="Soap">
<operation name="login">
<documentation>Login to the Salesforce.com SOAP Api</documentation>
<input message="tns:loginRequest"/>
<output message="tns:loginResponse"/>
<fault message="tns:LoginFault" name="LoginFault"/>
<fault message="tns:UnexpectedErrorFault" name="UnexpectedErrorFault"/>
<fault message="tns:InvalidIdFault" name="InvalidIdFault"/>
</operation>
</portType>
<!-- Soap Binding -->
<binding name="SoapBinding" type="tns:Soap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="login">
<soap:operation soapAction=""/>
<input>
<soap:header use="literal" message="tns:Header" part="LoginScopeHeader"/>
<soap:header use="literal" message="tns:Header" part="CallOptions"/>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="LoginFault">
<soap:fault name="LoginFault" use="literal"/>
</fault>
<fault name="UnexpectedErrorFault">
<soap:fault name="UnexpectedErrorFault" use="literal"/>
</fault>
<fault name="InvalidIdFault">
<soap:fault name="InvalidIdFault" use="literal"/>
</fault>
</operation>
</binding>
<!-- Soap Service Endpoint -->
<service name="SforceService">
<documentation>Sforce SOAP API</documentation>
<port binding="tns:SoapBinding" name="Soap">
<soap:address location="https://test.salesforce.com/services/Soap/u/30.0"/>
</port>
</service>

use load balancing with wso2esb

I use From Wso2 esb And Load Balancing Concept with sevices, but i have an error this is my code:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MultiAdd" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<log level="full" category="FATAL"/>
<property xmlns:tem="http://tempuri.org/" name="AParam" expression="//tem:SumSerVise/tem:a" scope="default" type="INTEGER"/>
<property xmlns:tem="http://tempuri.org/" name="BParam" expression="//tem:SumSerVise/tem:b" scope="default" type="INTEGER"/>
<log level="custom">
<property name="AParam" expression="$ctx:AParam"/>
<property name="BParam" expression="$ctx:BParam"/>
</log>
<payloadFactory>
<format>
<p:SumSerVise xmlns:p="http://tempuri.org/">
<!--Exactly 1 occurrence-->
<s:a xmlns:s="http://tempuri.org/">$1</s:a>
<!--Exactly 1 occurrence-->
<s:b xmlns:s="http://tempuri.org/">$2</s:b>
</p:SumSerVise>
</format>
<args>
<arg expression="$ctx:AParam"/>
<arg expression="$ctx:BParam"/>
</args>
</payloadFactory>
<log level="full"/>
<send receive="SeqOne">
<endpoint>
<address uri="http://D-N-PC-12071:8280/services/Add"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
</target>
<publishWSDL>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="SumSerVise">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="a" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="b" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SumSerViseResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SumSerViseResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="SumSerViseSoapIn">
<wsdl:part name="parameters" element="tns:SumSerVise"/>
</wsdl:message>
<wsdl:message name="SumSerViseSoapOut">
<wsdl:part name="parameters" element="tns:SumSerViseResponse"/>
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="SumSerVise">
<wsdl:input message="tns:SumSerViseSoapIn"/>
<wsdl:output message="tns:SumSerViseSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SumSerVise">
<soap:operation soapAction="http://tempuri.org/SumSerVise" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SumSerVise">
<soap12:operation soapAction="http://tempuri.org/SumSerVise" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="http://localhost/SumServices/Service.asmx"/>
</wsdl:port>
<wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="http://localhost/SumServices/Service.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</publishWSDL>
<description></description>
</proxy>
and this is my sequence:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="SeqOne">
<log level="full"/>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:m0="http://tempuri.org/" name="CParam" expression="//m0:SumSerViseResponse/m0:SumSerViseResult" scope="default" type="INTEGER"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="CParam" expression="$ctx:CParam"/>
</log>
<payloadFactory>
<format>
<p:MultiService xmlns:p="http://tempuri.org/">
<!--Exactly 1 occurrence-->
<s:z xmlns:s="http://tempuri.org/">$1</s:z>
</p:MultiService>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="$ctx:CParam"/>
</args>
</payloadFactory>
<log level="full"/>
<send>
<endpoint>
<loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
<endpoint name="mt">
<address uri="http://D-N-PC-12071:8280/services/MultiService/MultiService"/>
</endpoint>
<endpoint name="KR">
<address uri="http://D-N-PC-12071:8280/services/Multi/MultiService"/>
</endpoint>
</loadbalance>
</endpoint>
</send>
</sequence>
when use load balancing one of services return value 0 and other return correct value
i found my problem was in define endpoint kr and mt that wasnt correct
my parameters in multiservice should be compatible with source
parameters in mt was named "z"
<endpoint name="mt">
<address uri="http://D-N-PC-12071:8280/services/MultiService/MultiService"/>
</endpoint>
but parameters in kr was named "a"
<endpoint name="KR">
<address uri="http://D-N-PC-12071:8280/services/Multi/MultiService"/>
</endpoint>