All,
I have an issue with developing a contract-first SOAP web service in AnyPoint Studio (July 2014, with Muleserver 3.5.1 on max OS X, JDK 7). My process is:
Create WSDL by hand (XML Schema embedded inside WSDL for simplicity)
Create Synchronous HTTP flow in Anypoint
Generate Java classes from WSDL (no errors, works fine)
Start Flow from inside IDE (no errors,works fine).
Import WSDL and generate SOAP request in SOAPUI (no errors, works fine)
invoke SOAP request
AT this point I get the following error on marshalling the SOAP request (my flow has no backend logic and will fail - but that is not the issue):
org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://login.demo/}LoginServiceService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Message part {urn:MYNAMESPACE}requestParms was not recognized. (Does it exist in service WSDL?)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.validatePart(DocLiteralInInterceptor.java:231)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:201)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at org.mule.module.cxf.CxfInboundMessageProcessor.sendToDestination(CxfInboundMessageProcessor.java:338)
My WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:MYNAMESPACE"
xmlns:tns="urn:MYNAMESPACE"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wsdl:types>
<xs:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:MYNAMESPACE"
xmlns="urn:MYNAMESPACE"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="requestParms" type="LoginRequestType" />
<xs:element name="responseParms" type="LoginResponseType"/>
<xs:complexType name="LoginRequestType">
<xs:sequence>
<xs:element name="username" type="xs:string"/>
<xs:element name="password" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LoginResponseType">
<xs:sequence>
<xs:element name="success" type="xs:boolean"/>
<xs:element name="authenticatedToken" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<!-- MESSAGES -->
<wsdl:message name="LoginRequest">
<wsdl:part name="parameters" element="tns:requestParms"/>
</wsdl:message>
<wsdl:message name="LoginResponse">
<wsdl:part name="parameters" element="tns:responseParms"/>
</wsdl:message>
<!-- WSDL Port Types -->
<wsdl:portType name="AuthenticatePortType">
<wsdl:operation name="login">
<wsdl:input message="tns:LoginRequest"/>
<wsdl:output message="tns:LoginResponse"/>
</wsdl:operation>
</wsdl:portType>
<!-- WSDL Bindings -->
<wsdl:binding name="AuthenticateBinding" type="tns:AuthenticatePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="login">
<soap:operation soapAction="login"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- WSDL Services -->
<wsdl:service name="LoginService">
<wsdl:port name="LoginPort" binding="tns:AuthenticateBinding">
<soap:address location="http://localhost:8081/demo"/>
</wsdl:port>
</wsdl:service>
My Mule Config XML:
<http:endpoint exchange-pattern="request-response" host="localhost" port="8081" method="POST" name="HTTP" doc:name="HTTP"/>
<flow name="loginFlow" doc:name="loginFlow" initialState="started">
<http:inbound-endpoint exchange-pattern="request-response" path="demo" doc:name="Demo" host="localhost" port="8081"/>
<cxf:jaxws-service doc:name="CXF" validationEnabled="true" serviceClass="demo.login.LoginService"/>
</flow>
My SOAP Request:
<soapenv:Envelope xmlns:ns="urn:MYNAMESPACE"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<ns:requestParms>
<username>aa</username>
<password>bb</password>
</ns:requestParms>
</soapenv:Body>
</soapenv:Envelope>
Also, I have not modified the generated java code (wsdl2java I assume inside Anypoint) - just run it.
Any suggestions?
Related
I try to implement a SOAP-webservice with spring boot. Everything seems normal until I want to call it. I get the following Message:
No global element for root was found: {urn:com.companyname.dto}CalloutRequest
The wsdl looks the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:com.companyname"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:com.companyname"
xmlns:dto="urn:com.companyname.dto">
<wsdl:types>
<xs:schema targetNamespace="urn:com.companyname">
<xs:import schemaLocation="CalloutServiceDto.xsd" namespace="urn:com.companyname.dto"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="CalloutRequestMessage">
<wsdl:part name="request" element="dto:CalloutRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="CalloutResponseMessage">
<wsdl:part name="response" element="dto:CalloutResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CalloutPortType">
<wsdl:operation name="callMeldungAusgang">
<wsdl:documentation>Wird eine KVUVMeldung zurueck ins SHIP erzeugt, erfolgt dies ueber diesen Service.
</wsdl:documentation>
<wsdl:input message="tns:CalloutRequestMessage"></wsdl:input>
<wsdl:output message="tns:CalloutResponseMessage"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalloutBinding" type="tns:CalloutPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="callMeldungAusgang">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalloutService">
<wsdl:port name="CalloutPort" binding="tns:CalloutBinding">
<soap:address location="http://localhost:8080/Callout" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="urn:com.companyname.dto"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:com.companyname.dto"
elementFormDefault="qualified">
<xs:element name="CalloutRequest"
type="tns:CalloutRequestType" />
<xs:element name="CalloutResponse"
type="tns:CalloutResponseType" />
<xs:complexType name="CalloutRequestType">
<xs:annotation>
<xs:documentation>
Request fuer einen MeldungsAusgang, welcher ins gesendet wird.
e Beinhaltet nur das Response-XML, gehalten als String.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="xml" type="xs:string" minOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CalloutResponseType">
<xs:annotation>
<xs:documentation>
Die Antwort der MeldungsAusgangs-Service
</xs:documentation>
</xs:annotation>
</xs:complexType>
</xs:schema>
If I call the webservice he gives me the error that there is no root element. I generate my code with wsdl2java and it works just fine. Just when I call the service via http://localhost:8080/Callout it gives me the error.
Thanks in advance
Let's have a simple WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.test.com"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.test.com">
<wsdl:types>
<xs:schema targetNamespace="http://www.test.com">
<xs:element name="sessionId" type="xs:string">
</xs:element>
<xs:element name="transactionId" type="xs:string">
</xs:element>
<xs:element name="Login">
<xs:complexType>
<xs:sequence>
<xs:element name="userId" type="xs:string">
</xs:element>
<xs:element name="pwd" type="xs:string">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="LoginResponse">
<xs:complexType />
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="Login">
<wsdl:part name="parameters" element="Login"/>
</wsdl:message>
<wsdl:message name="LoginResponse">
<wsdl:part name="parameters" element="LoginResponse"/>
</wsdl:message>
<wsdl:message name="HeaderSessionId">
<wsdl:part name="header" element="sessionId"/>
</wsdl:message>
<wsdl:message name="HeaderTransactionId">
<wsdl:part name="header" element="transactionId"/>
</wsdl:message>
<wsdl:portType name="MMCServicesPort">
<wsdl:operation name="Login">
<wsdl:input message="Login"/>
<wsdl:output message="LoginResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MMCServicesBinding" type="MMCServicesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Login">
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:header message="HeaderSessionId" part="header" use="literal"/>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MMCServicesService">
<wsdl:port name="MMCServicesService" binding="MMCServicesBinding">
<soap:address location="/test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
For this WSDL the following message is a valid response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:test="http://www.test.com">
<soapenv:Header>
<test:sessionId>xxx</test:sessionId>
</soapenv:Header>
<soapenv:Body>
<test:LoginResponse/>
</soapenv:Body>
</soapenv:Envelope>
What/How do I need to change the WSDL to accept the following message as the Login operation response message instead:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<sessionId xmlns="http://www.test.com">xxx</sessionId>
</soapenv:Header>
<soapenv:Body>
<LoginResponse/>
</soapenv:Body>
</soapenv:Envelope>
...the LoginResponse is w/o a namespace definition.
I have a WS with unknown WSDL which doesn't provide the WSDL. The one above has been somehow reconstructed by someone else in the history. However the real WS which I need to use provides the 2nd response which is however refused by the Apache CXF java library.
Thank you.
The core issue seems to come with the definition of targetNamespace
in your code:
<xs:schema targetNamespace="http://www.test.com">
when replaced with:
<xs:schema targetNamespace="">
the SOAP XML should be without any prefix.
It might require also define the empty or default namespace at the wsdl:binding and wsdl:service level:
<wsdl:binding name="MMCServicesBinding" type="MMCServicesPort" xmlns="">
...
<wsdl:service name="MMCServicesService" xmlns="">
You might have built some code stubs based on that WSDL then you have to update also this generated code.
I am beginning with Mule flows. I am trying to consume a webservice in it.
But I am getting some some errors while running.
Error reported by XML parser: Content is not allowed in prolog
Here is my code
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8095" doc:name="HTTP Listener Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="MSCRMDiscoveryService_WSDL.wsdl" service="DiscoveryService" port="CustomBinding_IDiscoveryService" serviceAddress="https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svc" doc:name="Web Service Consumer"/>
<data-mapper:config name="Xml_ExecuteResponse__To_Xml_Execute_" transformationGraphPath="xml_executeresponse__to_xml_execute_.grf" doc:name="Xml_ExecuteResponse__To_Xml_Execute_"/>
<data-mapper:config name="Xml_ExecuteResponse__To_Xml_Execute__1" transformationGraphPath="xml_executeresponse__to_xml_execute__1.grf" doc:name="Xml_ExecuteResponse__To_Xml_Execute__1"/>
<flow name="mscrmdiscoveryservice-consumerFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="*" doc:name="HTTP"/>
<data-mapper:transform config-ref="Xml_ExecuteResponse__To_Xml_Execute_" doc:name="Xml<ExecuteResponse> To Xml<Execute>"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="Execute" doc:name="Web Service Consumer"/>
<data-mapper:transform config-ref="Xml_ExecuteResponse__To_Xml_Execute__1" doc:name="Xml<ExecuteResponse> To Xml<Execute>"/>
</flow>
</mule>
wsdl file
<?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://example.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="HelloWorldService" targetNamespace="http://example.org/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.org/" elementFormDefault="unqualified" targetNamespace="http://example.org/" version="1.0">
<xs:element name="sayHi" type="tns:sayHi"/>
<xs:element name="sayHiResponse" type="tns:sayHiResponse"/>
<xs:complexType name="sayHi">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHiResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHi">
<wsdl:part element="tns:sayHi" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHiResponse">
<wsdl:part element="tns:sayHiResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHi">
<wsdl:input message="tns:sayHi" name="sayHi">
</wsdl:input>
<wsdl:output message="tns:sayHiResponse" name="sayHiResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHi">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHi">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHiResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldPort">
<soap:address location="http://localhost:8085/hello"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
How can I fix this error?
From the flow you shared, is difficult to tell where the error exactly exists ... It may be your from your wrong XML structure.
Also not clear the use of Datamapper in consuming external web service
The easiest way to consume an existing web service from Mule flow is to prepare/build the soap request for the external service using set payload or XSLT transformer, and then dispatch it through HTTP outbound or HTTP request component.
I'm trying to query a WS from IBMIntegrationBus v10 using the SOAPRequest node.
SoapUI has no problems consuming this WS with the following payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsg="http://wsgetrama.wsbeans.iseries/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Header/>
<soapenv:Body>
<out:wsgetrama xmlns:out="http://wsgetrama.wsbeans.iseries/">
<arg0>
<PERAMA>1</PERAMA>
<PERAMD>Test</PERAMD>
</arg0>
</out:wsgetrama>
</soapenv:Body>
</soapenv:Envelope>
The raw data is as follows:
POST http://192.168.1.116:10028/web/services/WSGETRAMAService/WSGETRAMA HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 643
Host: 192.168.1.116:10028
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
I'm trying to consume a WS with the following WSDL:
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://wsgetrama.wsbeans.iseries/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="WSGETRAMA" targetNamespace="http://wsgetrama.wsbeans.iseries/">
<types>
<xs:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://wsgetrama.wsbeans.iseries/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://wsgetrama.wsbeans.iseries/" version="1.0">
<xs:element name="wsgetrama" type="tns:wsgetrama"/>
<xs:element name="wsgetramaResponse" type="tns:wsgetramaResponse"/>
<xs:complexType name="wsgetrama">
<xs:sequence>
<xs:element name="arg0" type="tns:wsgetramaInput"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaInput">
<xs:sequence>
<xs:element name="PERAMA" type="xs:decimal"/>
<xs:element name="PERAMD" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaResponse">
<xs:sequence>
<xs:element name="return" type="tns:wsgetramaResult"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaResult">
<xs:sequence>
<xs:element name="PERAMD" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="wsgetrama">
<part element="tns:wsgetrama" name="parameters"></part>
</message>
<message name="wsgetramaResponse">
<part element="tns:wsgetramaResponse" name="parameters"></part>
</message>
<portType name="WSGETRAMAServices">
<operation name="wsgetrama">
<input message="tns:wsgetrama" wsam:Action="http://wsgetrama.wsbeans.iseries/WSGETRAMAServices/wsgetramaRequest"></input>
<output message="tns:wsgetramaResponse" wsam:Action="http://wsgetrama.wsbeans.iseries/WSGETRAMAServices/wsgetramaResponse"></output>
</operation>
</portType>
<binding name="WSGETRAMAServicesPortBinding" type="tns:WSGETRAMAServices">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="wsgetrama">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WSGETRAMA">
<port binding="tns:WSGETRAMAServicesPortBinding" name="WSGETRAMAServicesPort">
<soap:address location="http://192.168.1.116:10028/web/services/WSGETRAMAService/WSGETRAMA"/>
</port>
</service>
</definitions>
While SoapUI has no problems consuming it, when I try the same on the integration bus, I get the following error:
The given SOAPAction wsgetrama does not match an operation
For consuming this WS, I've imported the mentioned WSDL and based the SOAPRequest Node on it.
Any ideas will be greatly appreciated!
Thanks!
Sean
I'm having the same problem. I'm trying to consume a web service exposed in jboss EAP 6.2 from IBM Integration Bus message flow, and I got the same message (the service goes unresponsive and looking at server.log I noticed the same error "The given SOAPAction generarDocumento does not match an operation").
The wsdl indeed contains a soapaction that is blank:
<wsdl:operation name="generarDocumento">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="generarDocumento">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="generarDocumentoResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ControladaException">
<soap:fault name="ControladaException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
After hours I've found this on IBM Knowledge Base:
"If a SOAPAction is set to an empty string in the HTTPInput header, it is overridden, unless the action is set explicitly in the HTTPRequest header, for example:
SET OutputRoot.HTTPRequestHeader.SOAPAction = InputRoot.HTTPInputHeader.SOAPAction
"
I'm using a JavaCompute node, so I'm still figuring out how to translate the above ESQL Code to Java, in order to replace the HTTP Request and set the soapaction to blank.
I'll let you all know if I made it.
I have a web-service stub implemented with JAX-WS and deployed on JBossAS 7. Here is a source code:
package org.mycompany.adapters.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.soap.Addressing;
#WebService
#Addressing(enabled = true, required = true)
public class AdapterSessionManager {
#WebMethod
public String initAdapterSession() {
return "hello";
}
}
Here is a WSDL generated by JBoss for this web-service:
<wsdl:definitions name="AdapterSessionManagerService" targetNamespace="http://ws.adapters.mycompany.org/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.adapters.mycompany.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xs:schema elementFormDefault="unqualified" targetNamespace="http://ws.adapters.mycompany.org/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="initAdapterSession" type="tns:initAdapterSession"/>
<xs:element name="initAdapterSessionResponse" type="tns:initAdapterSessionResponse"/>
<xs:complexType name="initAdapterSession">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="initAdapterSessionResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="initAdapterSessionResponse">
<wsdl:part element="tns:initAdapterSessionResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="initAdapterSession">
<wsdl:part element="tns:initAdapterSession" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AdapterSessionManager">
<wsdl:operation name="initAdapterSession">
<wsdl:input message="tns:initAdapterSession" name="initAdapterSession" wsam:Action="http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSessionRequest" wsaw:Action="http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSessionRequest"/>
<wsdl:output message="tns:initAdapterSessionResponse" name="initAdapterSessionResponse" wsam:Action="http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSessionResponse" wsaw:Action="http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSessionResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AdapterSessionManagerServiceSoapBinding" type="tns:AdapterSessionManager">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsaw:UsingAddressing wsdl:required="true"/>
<wsp:PolicyReference URI="#AdapterSessionManagerServiceSoapBinding_WSAM_Addressing_Policy"/>
<wsdl:operation name="initAdapterSession">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="initAdapterSession">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="initAdapterSessionResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AdapterSessionManagerService">
<wsdl:port binding="tns:AdapterSessionManagerServiceSoapBinding" name="AdapterSessionManagerPort">
<soap:address location="http://localhost:8081/adapters/AdapterSessionManager"/>
</wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="AdapterSessionManagerServiceSoapBinding_WSAM_Addressing_Policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsam:Addressing>
<wsp:Policy/>
</wsam:Addressing>
</wsp:Policy>
</wsdl:definitions>
When I try to invoke initAdapterSession with the following SOAP-request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.adapters.mycompany.org/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSessionRequest</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<ws:initAdapterSession/>
</soapenv:Body>
</soapenv:Envelope>
"A required header representing a Message Addressing Property is not present" SOAP fault occurs:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Action xmlns="http://www.w3.org/2005/08/addressing">http://ws.adapters.mycompany.org/AdapterSessionManager/initAdapterSession/Fault/SoapFault</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:d5b5c6aa-fd66-49bd-b928-488fa8e07f7b</MessageID>
<RelatesTo xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/unspecified</RelatesTo>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode xmlns:ns1="http://www.w3.org/2005/08/addressing">ns1:MessageAddressingHeaderRequired</faultcode>
<faultstring>A required header representing a Message Addressing Property is not present</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The SOAP-request is sent by soapUI. All WS-A options in soapUI preferences (WS-A settings tab) are disabled. Enable WS-A addressing checkbox in request settings is switched off too. Actually the same error occurs even when all these options are enabled.
Why JBoss doesn't see WS-A header within the request?
The SOAP fault "A required header representing a Message Addressing Property is not present" happens when a SOAP message does not have all the required WS-Addressing header information. It's not a JBoss specific exception, I've had this happen to me on WebSphere as well.
Your request only shows that it's sending the Action header. Looking at the spec (http://www.w3.org/Submission/ws-addressing/#_Toc77464323) it seems you need to send both the Action and To headers. The other option is to not send any WS-Addressing headers at all, but I would guess that, based on your WSDL, the server may not accept messages without WS-Addressing.
Just found lacking header. The fault doesn't arise if wsa:MessageID is passed with a SOAP-request. In my opinion it's a weird behavior, given that the wsa:MessageID is described as an optional header in WS-A 1.0 specification.