Configuring HTTP endpoint with SOAP in Mule Flows - soap

I am trying to configure an existing SOAP web service in Mule using Mule Flows. I have an HTTP endpoint with request/response and a SOAP component, say Service A.
I want to configure this setup for a simple flow to work. I have set my HTTP endpoint and the SOAP service. The flow file is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="demoflowFlow1" doc:name="demoflowFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<cxf:jaxws-service port="8082" serviceClass="com.myapp.serviceA.ServiceAImplService" doc:name="SOAP"/>
</flow>
</mule>
This is not working. My service is a simple one and it takes in a string and returns a string.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
public String hello(String user) {
return "at service A: " + user;
}
}
I am invoking my flow with the HTTP inbound URL http://localhost:8081/{I am not sure what goes here!} and getting:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>No such operation: (HTTP GET PATH_INFO: /)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The Mule flow is running as an application in Mule Studio, and the service is running as a SOAP web service from Springsource toolsuite.
What am I doing wrong?
Original WSDL at http://localhost:8080/ServiceA/services/ServiceAImplPort?wsdl
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ServiceAImplService" targetNamespace="http://service.demo.myapp.com/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://service.demo.myapp.com/" schemaLocation="http://localhost:8080/ServiceA/services/ServiceAImplPort?xsd=serviceaimpl_schema1.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="helloResponse">
<wsdl:part element="tns:helloResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="hello">
<wsdl:part element="tns:hello" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="IServiceA">
<wsdl:operation name="hello">
<wsdl:input message="tns:hello" name="hello"></wsdl:input>
<wsdl:output message="tns:helloResponse" name="helloResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceAImplServiceSoapBinding" type="tns:IServiceA">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:Hello" style="document"/>
<wsdl:input name="hello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="helloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServiceAImplService">
<wsdl:port binding="tns:ServiceAImplServiceSoapBinding" name="ServiceAImplPort">
<soap:address location="http://localhost:8080/ServiceA/services/ServiceAImplPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
FYI, I can run the web service from SpringSource toolsuite without issues. Now, how do I invoke the web service from my HTTP inbound URL with a GET request?
[I presume simple web services like these take GET requests.]

I think you forgot the #WebMethod annotation at your method. This is basically what your error says: No operation.
Here is a very good example how you can do it.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
#WebMethod
#WebResult(name="result")
public String hello(#WebParam(name="user")String user) {
return "at service A: " + user;
}
}

It's very easy ... I guess com.myapp.serviceA.ServiceAImplService is your Service Implementation class and IServiceA.java is your Service class ... why don't you try this :-
There is something wrong in your wsdl.... Why < wsdl:service name="ServiceAImplService" > is ServiceAImplService ... instead it should be IServiceA .... ServiceAImplService is the web service implementation class I guess and should be kept in in mule flow

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:

PERL WCF Web Service Call Fails

I am making web service calls using PERL to one of our vendor provided web services. The web services use SOAP 1.2 and WSHttpBinding.
I am able to make calls successfully to most of the calls in the web service, except for the RetrieveReport call. The RetrieveReport call is supposed to stream a file. However I am getting the response below.
An example to call the RetrieveReport was provided using C# code mentioning to use the following binding. However I have no clue how to do this in PERL. If anyone can provide any assistance, I thank you in advance.
C# App Config Binding
<binding name="WSHttpBinding_IBIStreamService" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
PERL Code
my $reportKey = 'report_key';
my $reportUri = 'report_uri';
my $xml = new XML::Simple;
my $userAgent = LWP::UserAgent->new(agent => 'https://service.com/services/BIDataService');
my $message = <<'.';
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport</a:Action>
<h:ReportKey xmlns:h="http://service.com/dataservices/bistream/2" xmlns="http://service.com/dataservices/bistream/2">[ReportKey]</h:ReportKey>
<a:To s:mustUnderstand="1">[ReportRetrievalUri]</a:To>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveReportRequest xmlns="http://service.com/dataservices/bistream/2" />
</s:Body>
</s:Envelope>
.
# Replace the dynamic values
$message =~ s/\[ReportKey\]/$reportKey/g;
$message =~ s/\[ReportRetrievalUri\]/$reportUri/g;
my $request = HTTP::Request->new(POST => $uri);
$request->header(SOAPAction => '"http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport"');
$request->content($message);
$request->content_type("application/soap+xml; charset=utf-8");
print "-- CONTENT --\n\n";
print $request->content . "\n\n";
my $response = $userAgent->request($request);
if ($response->is_success) {
print "--SUCCESS--\n" . $response->decoded_content . "\n";
} else {
print "--FAILURE--\n" . $response->status_line, "\n";
print $response->error_as_HTML;
}
Response From Vendor
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The message with Action \'http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport\' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
WSDL Source
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="BIStreamService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="http://service.com/dataservices/bistream/2" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsp:Policy wsu:Id="WSHttpBinding_IBIStreamService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:import namespace="http://service.com/dataservices/bistream/2" location="https://service.com/services/BIStreamingService?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="WSHttpBinding_IBIStreamService" type="i0:IBIStreamService">
<wsp:PolicyReference URI="#WSHttpBinding_IBIStreamService_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveReport">
<soap12:operation soapAction="http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport" style="document"/>
<wsdl:input name="RetrieveReportRequest">
<soap12:header message="i0:RetrieveReportRequest_Headers" part="ReportKey" use="literal"/>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="StreamReportResponse">
<soap12:header message="i0:StreamReportResponse_Headers" part="Status" use="literal"/>
<soap12:header message="i0:StreamReportResponse_Headers" part="StatusMessage" use="literal"/>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_IBIStreamService" type="i0:IBIStreamService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveReport">
<soap:operation soapAction="http://service.com/dataservices/bistream/2/IBIStreamService/RetrieveReport" style="document"/>
<wsdl:input name="RetrieveReportRequest">
<soap:header message="i0:RetrieveReportRequest_Headers" part="ReportKey" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="StreamReportResponse">
<soap:header message="i0:StreamReportResponse_Headers" part="Status" use="literal"/>
<soap:header message="i0:StreamReportResponse_Headers" part="StatusMessage" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BIStreamService">
<wsdl:port name="WSHttpBinding_IBIStreamService" binding="tns:WSHttpBinding_IBIStreamService">
<soap12:address location="https://service.com/services/BIStreamingService"/>
<wsa10:EndpointReference>
<wsa10:Address>https://service.com/services/BIStreamingService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="BasicHttpBinding_IBIStreamService" binding="tns:BasicHttpBinding_IBIStreamService">
<soap:address location="https://service.com/services/BIStreamingService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I found out the issue.
There are two URLs for the report web service. One to execute the report and a different one to retrieve the report. I modified the LWP::UserAgent->new(agent => '') and the HTTP::Request->new(POST => '') to both point to https://service.com/services/BIStreamingService when retrieving the report and now it works.
Thank you!

Perl SOAP::LITE service generated stub method within method

I have a SOAP::Lite client using the service method to grab a wsdl. This needs to call a webservice with a single operation and method with no parameters. It's resulting in a nested method call that the provider tells me is wrong. And I'm not very knowledgeable about SOAP::Lite or webservices. Advice appreciated!
my $lookup = SOAP::Lite->service('http://hostname.com/path/SpringVerifierWebServicePort?wsdl')
-> proxy("$theURL") ;
$response = $lookup->verifySpring('');
And that is generating this stub on the call.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body>
<tns:verifySpring>
<verifySpring xsi:nil="true" xsi:type="tns:verifySpring" />
</tns:verifySpring> </soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x167bee8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
The provider of that webservice tells me the 500 error is due to the nested verifySpring on the call. Do I need to call this differently than I am, or is the WSDL invalid and screwing up SOAP::Lite? I don't know enough about SOAP and webservices to say if the problem is the WSDL, or if I need to call this differently in SOAP::LITE. Could anyone give me some direction please?
The provider WSDL is this:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="SpringVerifierWebServiceService" targetNamespace="http://webservice.springverifier.toolslang.fedins.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" targetNamespace="http://webservice.springverifier.toolslang.fedins.com" version="1.0">
<xs:element name="verifySpring" type="tns:verifySpring" />
<xs:element name="verifySpringResponse" type="tns:verifySpringResponse" />
<xs:complexType name="verifySpring">
<xs:sequence />
</xs:complexType>
<xs:complexType name="verifySpringResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:environmentInfo" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="environmentInfo">
<xs:sequence>
<xs:element minOccurs="0" name="dbRegion" type="xs:string" />
<xs:element minOccurs="0" name="jndi" type="xs:string" />
<xs:element minOccurs="0" name="springProfile" type="xs:string" />
<xs:element minOccurs="0" name="systemDate" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="verifySpringResponse">
<wsdl:part element="tns:verifySpringResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="verifySpring">
<wsdl:part element="tns:verifySpring" name="parameters" />
</wsdl:message>
<wsdl:portType name="SpringVerifierWebService">
<wsdl:operation name="verifySpring">
<wsdl:input message="tns:verifySpring" name="verifySpring" />
<wsdl:output message="tns:verifySpringResponse" name="verifySpringResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SpringVerifierWebServiceServiceSoapBinding" type="tns:SpringVerifierWebService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="verifySpring">
<soap:operation soapAction="" style="document" />
<wsdl:input name="verifySpring">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="verifySpringResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SpringVerifierWebServiceService">
<wsdl:port binding="tns:SpringVerifierWebServiceServiceSoapBinding" name="SpringVerifierWebServicePort">
<soap:address location="http://dev1.spring.service.fedins.com/fedservice/toolslang/springverifier/webservice/services/SpringVerifierWebServicePort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
'' is an actual value (empty string), use verifySpring(); and not verifySpring('');
Example
#!/usr/bin/perl --
use strict;
use warnings;
use SOAP::Lite;
my $soap = SOAP::Lite
-> uri('http://127.0.0.1/MyModule')
-> proxy('http://127.0.0.1:1203')
;;;;;;;;;
$soap->readable(1);
$soap->transport->add_handler("request_send", sub { print $_[0]->as_string,"\n"; return } );
eval { $soap->verifySpring(''); 1 } or print "$#\n";
eval { $soap->verifySpring(); 1 } or print "$#\n";
__END__
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 522
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule">
<c-gensym3 xsi:type="xsd:string" />
</verifySpring>
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 11.
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 475
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule" xsi:nil="true" />
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 12.

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).

How to built SOAP Header namespaces based on the WSDL file

I've been experiencing some issues with the header presentation of a SOAP Request. I think I'm missing something.
My (partial) wsdl looks like this:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:aws="http://xml.xxx.com"
xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A"
xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
targetNamespace="http://xml.xxx.com">
<wsdl:types>
<xsd:schema targetNamespace="http://xml.xxx.com">
<xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
<wsdl:part name="Session" element="ns0:Session"/>
</wsdl:message>
<wsdl:message name="Security_Authenticate_6_1">
<wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
</wsdl:message>
<wsdl:message name="Security_AuthenticateReply_6_1">
<wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
</wsdl:message>
<wsdl:portType name="XXXWebServicesPT">
<wsdl:operation name="Security_Authenticate">
<wsdl:input message="aws:Security_Authenticate_6_1"/>
<wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Security_Authenticate">
<soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
<wsdl:input>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XXXWebServices">
<wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
<soap:address location="https://test.webservices.xxx.com"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I want to access the Security_Authenticate action, in which case, the header must look something like:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
<soapenv:Body>
<vls:Security_Authenticate>
<vls:tagX>
<vls:tagY>yyy</vls:tagY>
<vls:tagZ>Z</vls:tagZ>
</vls:tagX>
</vls:Security_Authenticate>
</soapenv:Body>
</soapenv:Envelope>
How should I built my soapenvelope and my header namespaces?
Thanks.
You have to declare the namespace before you use the object in the xsd, so in your case, to use the Session object:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
...