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>
Related
We are changing our soap webservices from jetty to jaxws. The goal is to keep the same input message. I have used the original WSDL to create the service with netbeans. The WSDL is the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" type="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" type="xs:string"/>
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
When using this WSDL in soapui it results in the following input example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditieOperation>
<DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</DcxExpeditie>
</v1:DcxExpeditieOperation>
</soapenv:Body>
</soapenv:Envelope>
However, the original input format was:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</v1:DcxExpeditie>
</soapenv:Body>
</soapenv:Envelope>
so with no DcxExpeditieOperation tag and with the v1 namespace in front of DcxExpeditie
Is this possible and if so, how can I accomplish this?
Try to change SOAP binding from rpc to document to remove DcxExpeditieOperation tag:
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
To fix the namespace issue refer DcxExpeditie element insted of type:
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
Updated WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:element name="DcxExpeditieResponse" type="xs:string"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" element="tns:DcxExpeditieResponse" />
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I have a perl program that is accessing a soap server. when testing the soap server via SoapUI it works, but when using my perl program I get
Can't use an undefined value as an ARRAY reference at /Library/Perl/5.18/SOAP/WSDL.pm line 222.
Here is my perl script.
use SOAP::WSDL;
my $data = 'some data here';
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
my $client = SOAP::WSDL->new( 'wsdl' => "link_to_wsdl" );
my $result = $client->call('MyMethod', $data);
use Data::Dumper;
print Dumper($result);
Here is the WSDL
<?xml version="1.0"?>
<wsdl:definitions
name="Test"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:APISoapServer"
targetNamespace="urn:APISoapServer"
>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:APISoapServer">
<xsd:element name="MyMethod">
<xsd:complexType>
<xsd:complexContent mixed="true">
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="operand1" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="MyMethodResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Confirmation" maxOccurs="unbounded">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="response" type="xsd:string"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="MYAPIRequest">
<wsdl:part name="MYAPIRequestPart" element="tns:MyMethod"/>
</wsdl:message>
<wsdl:message name="MYAPIResponse">
<wsdl:part name="MYAPIResponsePart" element="tns:MyMethodResponse"/>
</wsdl:message>
<wsdl:portType name="MYAPIServerPort">
<wsdl:operation name="MyMethod">
<wsdl:input name="MyMethodInput" message="tns:MYAPIRequest"/>
<wsdl:output name="MyMethodOutput" message="tns:MYAPIResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MYAPIServerBinding" type="tns:MYAPIServerPort">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="MyMethod">
<soap12:operation style="document" soapAction="urn:APISoapServer#MyMethod" />
<wsdl:input name="MyMethodInput">
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output name="MyMethodOutput">
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MYAPIService">
<wsdl:port name="MYAPIPort" binding="tns:MYAPIServerBinding">
<soap12:address location="https://my.site.com/api/my_api_server.pl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
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>
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).
I have a simple scenario we've been trying to implement but we could not figure out how to do it.
Assume we have two services with the dame WSDL (below).
We want to create a proxy in WSO2 that exposes the same WSDL but routes the call to one of the two backend services based on the value of the IntValue.
IF IntValue = 1 THEN it calls
http://localhost/WcfServiceDual_1/Service1.svc
ELSE IF IntValue = 2 THEN it calls
http://localhost/WcfServiceDual_2/Service1.svc
After that the proxy returns the response that comes from the corresponding (called) service.
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="Service1" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost/WcfServiceDual_2/Service1.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost/WcfServiceDual_2/Service1.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost/WcfServiceDual_2/Service1.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WcfServiceDual_2"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IService1_GetData_InputMessage">
<wsdl:part name="parameters" element="tns:GetData"/>
</wsdl:message>
<wsdl:message name="IService1_GetData_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataResponse"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataUsingDataContract_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataUsingDataContract"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataUsingDataContract_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataUsingDataContractResponse"/>
</wsdl:message>
<wsdl:portType name="IService1">
<wsdl:operation name="GetData">
<wsdl:input wsaw:Action="http://tempuri.org/IService1/GetData" message="tns:IService1_GetData_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IService1/GetDataResponse" message="tns:IService1_GetData_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetDataUsingDataContract">
<wsdl:input wsaw:Action="http://tempuri.org/IService1/GetDataUsingDataContract" message="tns:IService1_GetDataUsingDataContract_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IService1/GetDataUsingDataContractResponse" message="tns:IService1_GetDataUsingDataContract_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IService1" type="tns:IService1">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetData">
<soap:operation soapAction="http://tempuri.org/IService1/GetData" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetDataUsingDataContract">
<soap:operation soapAction="http://tempuri.org/IService1/GetDataUsingDataContract" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service1">
<wsdl:port name="BasicHttpBinding_IService1" binding="tns:BasicHttpBinding_IService1">
<soap:address location="http://localhost/WcfServiceDual_2/Service1.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Why you are hosting two instances of the same service ?
Anyway the logic you plan to have in the proxy is very simple. From the incoming request just extarct the param which you want to evaluate and based on that route the request to the differnt endpoint. You can use the filter mediator for this.
I found the solution:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="DualTest" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="custom" separator=",">
<property name="MessageFlow" value="______"/>
</log>
<property xmlns:xs="http://schemas.datacontract.org/2004/07/WcfServiceDual_1" xmlns:p="http://tempuri.org/" name="intValue" expression="//p:GetDataUsingDataContract/p:composite/xs:IntValue/text()" scope="default" type="STRING"/>
<property xmlns:xs="http://schemas.datacontract.org/2004/07/WcfServiceDual_1" xmlns:p="http://tempuri.org/" name="stringValue" expression="//p:GetDataUsingDataContract/p:composite/xs:StringValue/text()" scope="default" type="STRING"/>
<log level="custom">
<property name="intValue" expression="$ctx:intValue"/>
<property name="stringValue" expression="$ctx:stringValue"/>
</log>
<log level="custom" separator=",">
<property name="MessageFlow" value="______"/>
<property name="MessageFlow" value="\n======================= Sending Request To : Backend ======================="/>
</log>
<log level="full" separator=","/>
<filter source="get-property('intValue')" regex="2">
<then>
<log level="custom" separator=",">
<property name="IF" value="***** 2"/>
</log>
<send>
<endpoint>
<address uri="http://Win8/WcfServiceDual_2/Service1.svc"/>
</endpoint>
</send>
</then>
<else>
<log level="custom" separator=",">
<property name="ELSE" value="***** 1"/>
</log>
<send>
<endpoint>
<address uri="http://Win8/WcfServiceDual_1/Service1.svc"/>
</endpoint>
</send>
</else>
</filter>
<log level="custom" separator=",">
<property name="MessageFlow" value="______"/>
</log>
</inSequence>
</target>
<publishWSDL uri="http://localhost/WcfServiceDual_1/Service1.svc?wsdl"/>
<description></description>
</proxy>