WSDL cxf custom bindings - cxf-codegen-plugin

I am trying to change the class names of cxf generated source from an inline WSDL. The bindings I specify using xpath keeps getting ignored.
Below is my binding file:
<jaxws:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
targetNamespace="http://www.example.org/Small/"
version="1.0">
<jaxb:bindings node="//xsd:element[#name='NewOperationRequest']">
<jaxb:class name="xyz"/>
</jaxb:bindings>
</jaxws:bindings>
Below is my wsdl file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/Small/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Small" targetNamespace="http://www.example.org/Small/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/Small/">
<xsd:element name="NewOperationX">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="NewOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="NewOperationRequest">
<wsdl:part element="tns:NewOperationX" name="parameters"/>
</wsdl:message>
<wsdl:message name="NewOperationResponse">
<wsdl:part element="tns:NewOperationResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Small">
<wsdl:operation name="NewOperation">
<wsdl:input message="tns:NewOperationRequest"/>
<wsdl:output message="tns:NewOperationResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SmallSOAP" type="tns:Small">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="NewOperation">
<soap:operation soapAction="http://www.example.org/Small/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Small">
<wsdl:port binding="tns:SmallSOAP" name="SmallSOAP">
<soap:address location="http://www.example.org/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And below is my cxf pom plugin:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<configuration>
<sourceRoot>
target/generated-sources
</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/webapp/WEB-INF/wsdl/small.wsdl</wsdl>
<bindingFiles>
<bindingFile>${basedir}/src/main/webapp/WEB-INF/wsdl/small.xjb</bindingFile>
</bindingFiles>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
I wasn't able to find an example of custom bindings for inline WSDLs using CXF. Any help is appreciated. Thanks,

I think you have a namespace issue here. Your inner binding needs to be a jaxws binding rather than a jaxb binding.
Try the following as your innermost binding instead of your <jaxb:bindings> element (I've also modified your xpath):
<jaxws:bindings node="wsdl:definitions/wsdl:message[#name='NewOperationRequest']">
<class name="xyz"/>
</jaxws:bindings>
There's a similar example that renames a porttype on the Apache CXF site under the JAXWS Customization section.
For more options, here's a link on GitHub to a JAX-WS sample binding file demonstrating various parts of the wsdl you can customize.

Related

Error cvc-elt.1.a: Cannot find the declaration of element 'soapenv:Body'

I have already tried some hints but I get this problem not solved. I validated the wsdl with xmlspy-client and it says it and the xsd are valid.
When I send a Request like this with SOAPUI I get the Exception mentioned (cvc-elt.1.a: Cannot find the declaration of element 'soapenv:Body').
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://schemas.domain.com/wsdl/fuelprice/v1" xmlns:mod="http://schemas.domain.com/wsdl/fuelprice/v1/model">
<soapenv:Header/>
<soapenv:Body>
<v1:AuthenticationHeader client="client">
<v1:token>token</v1:token>
</v1:AuthenticationHeader>
<v1:GetAreaFuelStationsRequest provider="p1" prices="true">
<v1:area>
<mod:center ellipsoid="false">
<mod:latitude>22.519172</mod:latitude>
<mod:longitude>13.406093</mod:longitude>
</mod:center>
<mod:radius>10</mod:radius>
</v1:area>
</v1:GetAreaFuelStationsRequest>
</soapenv:Body>
</soapenv:Envelope>
I have tried importing the soap schema in the wsdl. After it I got an error message:
"cvc-complex-type.2.4.a: Invalid content was found starting with element 'v1:latitude'. One of '{"http://schemas.domain.com/wsdl/fuelprice/v1/model":latitude}' is expected.".
I honestly work with rest and json and have some difficulties with this schema-configuration.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="wsdl-viewer.xsl"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://schemas.domain.com/wsdl/fuelprice/v1" xmlns:model="http://schemas.domain.com/wsdl/fuelprice/v1/model" xmlns:exception="http://schemas.domain.com/wsdl/fuelprice/v1/exception" targetNamespace="http://schemas.domain.com/wsdl/fuelprice/v1">
<wsdl:types>
<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.domain.com/wsdl/fuelprice/v1" elementFormDefault="qualified">
<xsi:import namespace="http://schemas.domain.com/wsdl/fuelprice/v1/model" schemaLocation="common.xsd"/>
<xsi:import namespace="http://schemas.domain.com/wsdl/fuelprice/v1/exception" schemaLocation="exception.xsd"/>
<xsi:element name="GetAreaFuelStationsRequest">
<xsi:complexType>
<xsi:sequence>
<xsi:element name="area" type="model:Area"/>
</xsi:sequence>
<xsi:attribute name="provider" type="xsi:string" use="optional"/>
<xsi:attribute name="prices" type="xsi:boolean" use="required"/>
</xsi:complexType>
</xsi:element>
<xsi:element name="GetAreaFuelStationsResponse">
<xsi:complexType>
<xsi:sequence>
<xsi:element name="entry" type="model:SearchResult" minOccurs="0" maxOccurs="unbounded"/>
</xsi:sequence>
<xsi:attribute name="countTotal" type="xsi:int" use="optional"/>
</xsi:complexType>
</xsi:element>
</xsi:schema>
</wsdl:types>
<wsdl:message name="SearchAreaFuelStationsRequest">
<wsdl:part name="auth" element="tns:AuthenticationHeader"/>
<wsdl:part name="body" element="tns:GetAreaFuelStationsRequest"/>
</wsdl:message>
<wsdl:message name="SearchAreaFuelStationsResponse">
<wsdl:part name="body" element="tns:GetAreaFuelStationsResponse"/>
</wsdl:message>
<wsdl:portType name="FuelDataService">
<wsdl:operation name="GetAreaFuelStations">
<wsdl:input message="tns:GetAreaFuelStationsRequest"/>
<wsdl:output message="tns:GetAreaFuelStationsResponse"/>
<wsdl:fault name="ServiceError" message="tns:ServiceErrorFault"/>
<wsdl:fault name="AuthenticationError" message="tns:AuthenticationErrorFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="FuelDataService" type="tns:FuelDataService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetAreaFuelStations">
<soap:operation soapAction="urn:GetAreaFuelStations"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceError"/>
<wsdl:fault name="AuthenticationError"/>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="FuelDataService">
<wsdl:port name="FuelDataService" binding="tns:FuelDataService">
<soap:address location="No target address"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:model="http://schemas.domain.com/wsdl/fuelprice/v1/model" targetNamespace="http://schemas.domain.com/wsdl/fuelprice/v1/model" elementFormDefault="qualified">
<xsi:complexType name="FuelStation">
<xsi:sequence>
<xsi:element name="location" type="model:GeoLocation"/>
<xsi:element name="name" type="xsi:string"/>
</xsi:sequence>
<xsi:attribute name="id" type="xsi:long" use="optional"/>
</xsi:complexType>
<xsi:complexType name="GeoLocation">
<xsi:sequence>
<xsi:element name="latitude" type="xsi:double"/>
<xsi:element name="longitude" type="xsi:double"/>
</xsi:sequence>
<xsi:attribute name="ellipsoid" type="xsi:string" use="required"/>
</xsi:complexType>
<xsi:complexType name="Area">
<xsi:sequence>
<xsi:element name="center" type="model:GeoLocation"/>
<xsi:element name="radius" type="xsi:float"/>
</xsi:sequence>
</xsi:complexType>
</xsi:schema>
For me is not obvious what I should change to get this working. Does anybody knows what is wrong with the namespace setting? I would appreciate any help.
This Question was solved with the Question validating SOAP-Request with a SOAPHandler
Extracting the body of message, adding the needed namespace in the schema and validating the body as a Document did the trick.

Using WSO2 ESB PassThrough Proxy on WebLogic (Spring) Web Service

I have tried PassThroughu proxy tutorials and all works with build in example where Target Web Service is deployed on Axis (Apache CFX). Source and Proxy Web Service nicely gets tested using "TryIt" on WSO2 ESB.
Now different story - I try to achieve the same using very simple Weblogic Spring Web Service (i don't believe usage of Spring and bottom-up approach and annotations matter). It's deployed on the WebLogic server (running on the same host as WSO2 ESB). No any special WS-* extension included. It's almost hello world web service. I can easily test test it SoapUi, UniversalTestClient (WebLogic) and see WSDL in browser.
Regarding generated proxy PassThrough Web Service (followed same steps from tutorial) I can also see generated WSDL:
http://localhost:8280/services/WebServiceAServicePassThroughProxy?wsdl
However neither SoapUI nor TryIt work and both return FaultString:
The endpoint reference (EPR) for the Operation not found is /services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap11Endpoint and the WSA Action = . If this EPR was previously reachable, please contact the server administrator.
Here is function I used for testing "findContactById":
<body>
<p:findContactById xmlns:p="http://webservicea.testtoold.xx.yy.zz.eu/">
<!--Exactly 1 occurrence-->
<arg0>1</arg0>
</p:findContactById>
</body>
which operates on Proxy Web Service. I tried all endpoints that were generated in proxy web service, error is same as above unless if I try httpEndpoint from drop down:
http://localhost:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpEndpoint
then I get Unsupported Media Type as TryItProxyError.
Anyone please help, I am getting nuts with this... should be simple, not the nightmare. Searched all web i saw few similar questions with no answers.
WebLogic Service WSDL:
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservicea.testtoold.xx.yy.zz.eu/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservicea.testtoold.xx.yy.zz.eu/" name="WebServiceAService">
<types>
<xsd:schema>
<xsd:import namespace="http://webservicea.testtoold.xx.yy.zz.eu/" schemaLocation="http://localhost:7001/TestToolD/WebServiceAService?xsd=1"/>
</xsd:schema>
</types>
<message name="findContactById">
<part name="parameters" element="tns:findContactById"/>
</message>
<message name="findContactByIdResponse">
<part name="parameters" element="tns:findContactByIdResponse"/>
</message>
<message name="Exception">
<part name="fault" element="tns:Exception"/>
</message>
<message name="findAllContacts">
<part name="parameters" element="tns:findAllContacts"/>
</message>
<message name="findAllContactsResponse">
<part name="parameters" element="tns:findAllContactsResponse"/>
</message>
<portType name="WebServiceA">
<operation name="findContactById">
<input wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdRequest" message="tns:findContactById"/>
<output wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdResponse" message="tns:findContactByIdResponse"/>
<fault message="tns:Exception" name="Exception" wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactById/Fault/Exception"/>
</operation>
<operation name="findAllContacts">
<input wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsRequest" message="tns:findAllContacts"/>
<output wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsResponse" message="tns:findAllContactsResponse"/>
<fault message="tns:Exception" name="Exception" wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContacts/Fault/Exception"/>
</operation>
</portType>
<binding name="WebServiceAPortBinding" type="tns:WebServiceA">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="findContactById">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
<operation name="findAllContacts">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
</binding>
<service name="WebServiceAService">
<port name="WebServiceAPort" binding="tns:WebServiceAPortBinding">
<soap:address location="http://localhost:7001/TestToolD/WebServiceAService"/>
</port>
</service>
</definitions>
WSO ESB Generated PassThroughProxy.wsdl
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://webservicea.testtoold.xx.yy.zz.eu/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://webservicea.testtoold.xx.yy.zz.eu/">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xsd:import namespace="http://webservicea.testtoold.xx.yy.zz.eu/" schemaLocation="WebServiceAServicePassThroughProxy?xsd=http://localhost:7001/TestToolD/WebServiceAService?xsd=1.xsd"></xsd:import>
</xsd:schema>
</wsdl:types>
<wsdl:message name="findContactById">
<wsdl:part name="parameters" element="tns:findContactById"></wsdl:part>
</wsdl:message>
<wsdl:message name="findContactByIdResponse">
<wsdl:part name="parameters" element="tns:findContactByIdResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="findAllContacts">
<wsdl:part name="parameters" element="tns:findAllContacts"></wsdl:part>
</wsdl:message>
<wsdl:message name="findAllContactsResponse">
<wsdl:part name="parameters" element="tns:findAllContactsResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="WebServiceAServicePassThroughProxyPortType">
<wsdl:operation name="findContactById">
<wsdl:input message="tns:findContactById"></wsdl:input>
<wsdl:output message="tns:findContactByIdResponse" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdResponse"></wsdl:output>
<wsdl:fault message="tns:Exception" name="Exception" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactById/Fault/Exception"></wsdl:fault>
</wsdl:operation>
<wsdl:operation name="findAllContacts">
<wsdl:input message="tns:findAllContacts"></wsdl:input>
<wsdl:output message="tns:findAllContactsResponse" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsResponse"></wsdl:output>
<wsdl:fault message="tns:Exception" name="Exception" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContacts/Fault/Exception"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WebServiceAServicePassThroughProxySoap11Binding" type="tns:WebServiceAServicePassThroughProxyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<wsdl:operation name="findContactById">
<soap:operation soapAction="" style="document"></soap:operation>
<wsdl:input>
<soap:body use="literal"></soap:body>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"></soap:body>
</wsdl:output>
<wsdl:fault name="Exception">
<soap:fault use="literal" name="Exception"></soap:fault>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="findAllContacts">
<soap:operation soapAction="" style="document"></soap:operation>
<wsdl:input>
<soap:body use="literal"></soap:body>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"></soap:body>
</wsdl:output>
<wsdl:fault name="Exception">
<soap:fault use="literal" name="Exception"></soap:fault>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WebServiceAServicePassThroughProxySoap12Binding" type="tns:WebServiceAServicePassThroughProxyPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap12:binding>
<wsdl:operation name="findContactById">
<soap12:operation soapAction="" style="document"></soap12:operation>
<wsdl:input>
<soap12:body use="literal"></soap12:body>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"></soap12:body>
</wsdl:output>
<wsdl:fault name="Exception">
<soap12:fault use="literal" name="Exception"></soap12:fault>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="findAllContacts">
<soap12:operation soapAction="" style="document"></soap12:operation>
<wsdl:input>
<soap12:body use="literal"></soap12:body>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"></soap12:body>
</wsdl:output>
<wsdl:fault name="Exception">
<soap12:fault use="literal" name="Exception"></soap12:fault>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WebServiceAServicePassThroughProxyHttpBinding" type="tns:WebServiceAServicePassThroughProxyPortType">
<http:binding verb="POST"></http:binding>
<wsdl:operation name="findContactById">
<http:operation location="findContactById"></http:operation>
<wsdl:input>
<mime:content type="text/xml" part="parameters"></mime:content>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"></mime:content>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="findAllContacts">
<http:operation location="findAllContacts"></http:operation>
<wsdl:input>
<mime:content type="text/xml" part="parameters"></mime:content>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"></mime:content>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WebServiceAServicePassThroughProxy">
<wsdl:port name="WebServiceAServicePassThroughProxyHttpsSoap11Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap11Binding">
<soap:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsSoap11Endpoint"></soap:address>
</wsdl:port>
<wsdl:port name="WebServiceAServicePassThroughProxyHttpSoap11Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap11Binding">
<soap:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap11Endpoint"></soap:address>
</wsdl:port>
<wsdl:port name="WebServiceAServicePassThroughProxyHttpSoap12Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap12Binding">
<soap12:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap12Endpoint"></soap12:address>
</wsdl:port>
<wsdl:port name="WebServiceAServicePassThroughProxyHttpsSoap12Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap12Binding">
<soap12:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsSoap12Endpoint"></soap12:address>
</wsdl:port>
<wsdl:port name="WebServiceAServicePassThroughProxyHttpsEndpoint" binding="tns:WebServiceAServicePassThroughProxyHttpBinding">
<http:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsEndpoint"></http:address>
</wsdl:port>
<wsdl:port name="WebServiceAServicePassThroughProxyHttpEndpoint" binding="tns:WebServiceAServicePassThroughProxyHttpBinding">
<http:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpEndpoint"></http:address>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Few minor remarks:
differences in localhost and supercomputer can't be the cause - tutorials work well with such diffs
i tried lots of things (creating endpoint in registry, or locally, providing WSDL or not when creating proxy, etc etc, but I always get the identical error).
i have cut out 30% lines of code to simplify WSDL (save and delete functions) to reach allowed size of post.
tried adding action names but no difference (kept example without them)
Since ESB 4.6, pass-through transport is enabled by default : The message body is not build so, SOAP Body based dispatching is not supported (can't use the first child node of SOAP body element to determine the operation).
The error in this case is The endpoint reference (EPR) for the Operation not found is...
In your case, you can't use SOAPAction (it's blank), but you can :
append the operation name to the endpoint URL
Or, since ESB 4.8 :
add this parameter in the proxy conf : <parameter name="disableOperationValidation" locked="false">true</parameter>
modify axis2.xml conf in repository/conf/axis2 replacing
<handler class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/>
with
<handler class="org.apache.synapse.core.axis2.SynapseSOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/>

wso2 cache mediator response in binary (it should be XML)

I'm learning about wso2 ESB 4.6.0. I'm studying right now about mediators. I implemented cache mediator as below.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="cacheProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<cache id="myCache" scope="per-mediator" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="3" maxMessageSize="1000">
<implementation type="memory" maxSize="1000"/>
</cache>
<send>
<endpoint>
<address uri="http://localhost:44444/ws/MediatorsWS"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<cache id="myCache" scope="per-mediator" collector="true"/>
<send/>
</outSequence>
<endpoint>
<address uri="http://localhost:44444/ws/MediatorsWS"/>
</endpoint>
</target>
<publishWSDL uri="http://localhost:44444/ws/MediatorsWS?wsdl"/>
<description></description>
</proxy>
It redirects to a webservice implemented with JAX-WS receiving SOAP 1.1. Here is the wsdl:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://clone.ws.wso2lessons/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://clone.ws.wso2lessons/">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xsd:import namespace="http://clone.ws.wso2lessons/" schemaLocation="cacheProxy?xsd=http://localhost:44444/ws/MediatorsWS?xsd=1.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="receiveMessage">
<wsdl:part name="parameters" element="tns:receiveMessage"/>
</wsdl:message>
<wsdl:message name="receiveMessageResponse">
<wsdl:part name="parameters" element="tns:receiveMessageResponse"/>
</wsdl:message>
<wsdl:message name="replyMessage">
<wsdl:part name="parameters" element="tns:replyMessage"/>
</wsdl:message>
<wsdl:message name="replyMessageResponse">
<wsdl:part name="parameters" element="tns:replyMessageResponse"/>
</wsdl:message>
<wsdl:portType name="cacheProxyPortType">
<wsdl:operation name="receiveMessage">
<wsdl:input message="tns:receiveMessage" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/receiveMessageRequest"/>
<wsdl:output message="tns:receiveMessageResponse" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/receiveMessageResponse"/>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<wsdl:input message="tns:replyMessage" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/replyMessageRequest"/>
<wsdl:output message="tns:replyMessageResponse" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/replyMessageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="cacheProxySoap11Binding" type="tns:cacheProxyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="receiveMessage">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<soap:operation soapAction="" 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="cacheProxySoap12Binding" type="tns:cacheProxyPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="receiveMessage">
<soap12:operation soapAction="" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<soap12:operation soapAction="" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="cacheProxyHttpBinding" type="tns:cacheProxyPortType">
<http:binding verb="POST"/>
<wsdl:operation name="receiveMessage">
<http:operation location="receiveMessage"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<http:operation location="replyMessage"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="cacheProxy">
<wsdl:port name="cacheProxyHttpSoap11Endpoint" binding="tns:cacheProxySoap11Binding">
<soap:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsSoap11Endpoint" binding="tns:cacheProxySoap11Binding">
<soap:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsSoap12Endpoint" binding="tns:cacheProxySoap12Binding">
<soap12:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpSoap12Endpoint" binding="tns:cacheProxySoap12Binding">
<soap12:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsEndpoint" binding="tns:cacheProxyHttpBinding">
<http:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsEndpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpEndpoint" binding="tns:cacheProxyHttpBinding">
<http:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpEndpoint"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
When I send a message to operation replyMessage, the response message is cached succesfully (there is a System.out.println() on the java method, which is not called at the cache timeframe). However, the returned message I get is this:
<axis2ns27:binary xmlns:axis2ns27="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxTOkVudmVsb3BlIHhtbG5zOlM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj48UzpCb2R5PjxuczI6cmVwbHlNZXNzYWdlUmVzcG9uc2UgeG1sbnM6bnMyPSJodHRwOi8vY2xvbmUud3Mud3NvMmxlc3NvbnMvIj48cmV0dXJuPmhlbGxvIHRoZXJlIHJlc3BvbmRpZGEuPC9yZXR1cm4+PC9uczI6cmVwbHlNZXNzYWdlUmVzcG9uc2U+PC9TOkJvZHk+PC9TOkVudmVsb3BlPg==</axis2ns27:binary>
If I don't use this mediator, message is returned correctly. What am I missing here?
we use passthrough transport, it doesnt build the message..Can you switch back to NIO transport and check?

JAXB2 parsing WSDL containing soap encoded type

I have a problem with jaxb2 in my spring WS.
the Spring ws has to parse a wsdl file (no xsd) containing soap encoded types (Array).What maven plugin can i use to be able to marshall the wsdl file with JAXB2?
Here is the wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://xml.cibg.org/irisbox/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:impl="http://xml.cibg.org/irisbox/" xmlns:intf="http://xml.cibg.org/irisbox/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.cibg.org/irisbox/">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="soap-encoding.xsd"/>
<xsd:complexType name="ArrayOf_xsd_anyType">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ExternalIdsResponse">
<xsd:sequence>
<xsd:element name="externalIdsResponse" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<message name="getExternalIdsRequest">
<part name="organizationCode" type="xsd:string"/>
<part name="externalModuleName" type="xsd:string"/>
<part name="fromDate" type="xsd:dateTime"/>
<part name="toDate" type="xsd:dateTime"/>
</message>
<message name="getExternalIdsResponse">
<part name="getExternalIdsReturn" type="impl:ExternalIdsResponse"/>
</message>
<portType name="ExternalIdsService">
<operation name="getExternalIds" parameterOrder="organizationCode externalModuleName fromDate toDate">
<input name="getExternalIdsRequest" message="impl:getExternalIdsRequest"/>
<output name="getExternalIdsResponse" message="impl:getExternalIdsResponse"/>
</operation>
</portType>
<binding name="ExternalIdsSoapBinding" type="impl:ExternalIdsService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getExternalIds">
<wsdlsoap:operation soapAction=""/>
<input name="getExternalIdsRequest">
<wsdlsoap:body use="encoded" namespace="http://xml.cibg.org/irisbox/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output name="getExternalIdsResponse">
<wsdlsoap:body use="encoded" namespace="http://xml.cibg.org/irisbox/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="ExternalIdsServiceService">
<port name="ExternalIds" binding="impl:ExternalIdsSoapBinding">
<wsdlsoap:address location="http://172.31.50.155:8988/irisbox/anonymous/services/ExternalIds"/>
</port>
</service>
</wsdl:definitions>

Oracle Service Bus (11.1.1.6.0): <xsd:include> issue

IF I use this schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="Chick">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="count" type="xsd:decimal" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
With this wsdl:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/test/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test"
xmlns:chi="chick"
targetNamespace="http://www.example.org/test/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/test/">
<xsd:include schemaLocation="testschema.xsd"></xsd:include>
<xsd:include id="ada" schemaLocation="testschema.xsd" />
<xsd:element name="doTheRightThing">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Chick" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="doTheRightThingResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="doTheRightThingRequest">
<wsdl:part element="tns:doTheRightThing" name="parameters" />
</wsdl:message>
<wsdl:message name="doTheRightThingResponse">
<wsdl:part element="tns:doTheRightThingResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="test">
<wsdl:operation name="doTheRightThing">
<wsdl:input message="tns:doTheRightThingRequest" />
<wsdl:output message="tns:doTheRightThingResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testSOAP" type="tns:test">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="doTheRightThing">
<soap:operation
soapAction="http://www.example.org/test/doTheRightThing" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="test">
<wsdl:port binding="tns:testSOAP" name="testSOAP">
<soap:address location="http://www.example.org/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I get this error message:
Error building the Schema Type system for the WSDL:
D:\Oracle\Middleware_11.1.1.6.0\user_projects\domains\osb_cookbook_domain\test:0: error: src-resolve.a: Could not find element 'Chick'. Do you mean to refer to the element named Chick#http://www.example.org/test/ (in testschema)?
If I change this line in wsdl:
<xsd:element ref="Chick" />
to this:
<xsd:element ref="tns:Chick" />
I could not deploy, OEPE returns this error message:
The WSDL is not semantically valid: error: src-resolve: element 'Chick#http://www.example.org/test/' not found..
Is this a bug?
Patch 14003546 solved this issue:
WSDL WITH EMBEDDED SCHEMA INCLUDE TO NO-NAMESPACE FAILS VALIDATION

Resources