Update: This issue has been resolved. I was trying to authenticate various admin accounts which apparently are in a separate database than the user accounts this service talks to. I used a generic user account that I created in CISCO and the web service calls worked great!
I would like to thank #Yahia for the recommendation on running Fiddler also!
I've been reading over the CICCO UCP Web Service documentation for days now. I'm able to talk to the one web service on the box, with proper credentials and everything works fine; however, with the UCP Service, I get an error... SoapUI seems to understand the WSDL file, and I'm able to send a request to the endpoint but I get an authentication error, below.
I use the same username and password to login to the ACS Portal so the account is not expired. I'm pretty much lost on this one and at the mercy of CICSO tech support. Any and all ideas are welcome!
SOAP Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:authenticateUserResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://cisco.com/nm/acs/mgmt/ucp/service/">
<authenticateUserReturn href="#id0"/>
</ns1:authenticateUserResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ResponseType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://cisco.com/nm/acs/mgmt/ucp/service/">
<errors soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array">
<errors xsi:type="xsd:string">Credentials are incorrect.</errors>
</errors>
<status href="#id1"/>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:StatusCodeType" xmlns:ns3="http://cisco.com/nm/acs/mgmt/ucp/service/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">failure</multiRef>
</soapenv:Body>
</soapenv:Envelope>
Soap Envelope:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://cisco.com/nm/acs/mgmt/ucp/service/">
<soapenv:Header/>
<soapenv:Body>
<ser:authenticateUser soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<userName xsi:type="xsd:string">myusername</userName>
<password xsi:type="xsd:string">mypassword</password>
</ser:authenticateUser>
</soapenv:Body>
</soapenv:Envelope>
And the WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://www.cisco.com/wsdl.service"
xmlns:intf="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation>Copyright (c) 2007, 2009 Cisco Systems, Inc.
WSDL Service Interface for ACS5.1 User Change Password interface
(UCP) This WSDL document defines the publication API calls for
interacting with the ACS UCP service.</wsdl:documentation>
<wsdl:types>
<schema targetNamespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
<simpleType name="StatusCodeType">
<restriction base="string">
<enumeration value="success" />
<enumeration value="failure" />
</restriction>
</simpleType>
<complexType name="ResponseType">
<sequence>
<element name="errors" nillable="true"
type="intf:ArrayOf_xsd_string" />
<element name="status" nillable="false"
type="intf:StatusCodeType" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="changeUserPassRequest">
<wsdl:part name="userName" type="xsd:string" />
<wsdl:part name="oldPassword" type="xsd:string" />
<wsdl:part name="newPassword" type="xsd:string" />
</wsdl:message>
<wsdl:message name="authenticateUserRequest">
<wsdl:part name="userName" type="xsd:string" />
<wsdl:part name="password" type="xsd:string" />
</wsdl:message>
<wsdl:message name="changeUserPassResponse">
<wsdl:part name="changeUserPassReturn"
type="intf:ResponseType" />
</wsdl:message>
<wsdl:message name="authenticateUserResponse">
<wsdl:part name="authenticateUserReturn"
type="intf:ResponseType" />
</wsdl:message>
<wsdl:portType name="UCP">
<wsdl:operation name="authenticateUser"
parameterOrder="userName password">
<wsdl:input message="intf:authenticateUserRequest"
name="authenticateUserRequest" />
<wsdl:output message="intf:authenticateUserResponse"
name="authenticateUserResponse" />
</wsdl:operation>
<wsdl:operation name="changeUserPass"
parameterOrder="userName oldPassword newPassword">
<wsdl:input message="intf:changeUserPassRequest"
name="changeUserPassRequest" />
<wsdl:output message="intf:changeUserPassResponse"
name="changeUserPassResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UCP" type="intf:UCP">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="authenticateUser">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="authenticateUserRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:input>
<wsdl:output name="authenticateUserResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="changeUserPass">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="changeUserPassRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:input>
<wsdl:output name="changeUserPassResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UCPService">
<wsdl:port binding="intf:UCP" name="UCP">
<wsdlsoap:address location="https://localhost/PI/services/UCP/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Update: This issue has been resolved. I was trying to authenticate various admin accounts which apparently are in a separate database than the user accounts this service talks to. I used a generic user account that I created in CISCO and the web service calls worked great!
I would like to thank #Yahia for the recommendation on running Fiddler also!
Related
Setting up a webservice on my Symfony server, I follow this guide:
https://symfony.com/doc/current/controller/soap_web_service.html
Example given is working well, with this hello fonction:
public function hello($name)
{
return 'Hello, '.$name;
}
So I've tried to complete this webservice with this bye function:
public function bye($name)
{
return 'Goodbye, '.$name;
}
And here is my wsdl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:arnleadservicewsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:helloservicewsdl">
<types>
<xsd:schema targetNamespace="urn:hellowsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="helloRequest">
<part name="name" type="xsd:string" />
</message>
<message name="helloResponse">
<part name="return" type="xsd:string" />
</message>
<message name="byeRequest">
<part name="name" type="xsd:string" />
</message>
<message name="byeResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="hellowsdlPortType">
<operation name="hello">
<documentation>Hello World</documentation>
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
<operation name="bye">
<documentation>Goodbye World</documentation>
<input message="tns:byeRequest"/>
<output message="tns:byeResponse"/>
</operation>
</portType>
<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:arnleadservicewsdl#hello" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="bye">
<soap:operation soapAction="urn:arnleadservicewsdl#bye" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="hellowsdl">
<port name="hellowsdlPort" binding="tns:hellowsdlBinding">
<soap:address location="http://10.0.0.42/esi/soap" />
</port>
</service>
</definitions>
Hello function is still working, but each time i call bye function, I get an error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML
Where am I wrong?
Ok, first I have rewritten my WSDL with help of https://www.wsdl-analyzer.com/. Here is my new WSDL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions name="helloServiceController"
targetNamespace="urn:helloServiceControllerwsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:helloServiceControllerwsdl">
<wsdl:types>
<xsd:schema targetNamespace="urn:helloServiceControllerwsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="helloRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="helloResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="helloServicePortType">
<wsdl:operation name="hello">
<wsdl:documentation>Hello World</wsdl:documentation>
<wsdl:input message="tns:helloRequest"/>
<wsdl:output message="tns:helloResponse"/>
</wsdl:operation>
<wsdl:operation name="bye">
<wsdl:documentation>Bye World</wsdl:documentation>
<wsdl:input message="tns:byeRequest"/>
<wsdl:output message="tns:byeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="helloServiceBinding" type="tns:helloServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:helloServiceControllerwsdl#hello" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="bye">
<soap:operation soapAction="urn:helloServiceControllerwsdl#bye" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="helloService">
<wsdl:port name="helloServicePort" binding="tns:helloServiceBinding">
<soap:address location="http://10.0.0.42/esi/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
After that, it was still not working and even hello function was not working. After pulling my hair for a while, I simply restarted my server and it was good. Probably a cache problem!
I am working on IBM Sterling V 9.3. I have exposed an Service as JAX-WS web service using the steps provided in the knowledge center successfully on Jboss 4.2.3 app server. EAR file got deployed successfully and app server started fine. I could see the generated WSDL file for the web service.
When I tried to access the WSDL from soapUI tool (version 3.5.1), I am getting the following error in the response message. I searched for the same and found out that we should have following jars under JBOSS_HOME\lib\endorsed folder:
• jboss-saaj.jar
• jboss-jaxws.jar
• jboss-jaxrpc.jar
• jaxb-api-2.1.9.jar
• xercesImpl.jar
• xalan.jar
• serializer.jar
I have added above jars but still getting the same error. Can share the more details if required. Please help.
Error message:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SearsBeansService"
targetNamespace="http://webservices.sears.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://webservices.sears.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/output" schemaLocation="SearsBeansService_schema1.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/input" schemaLocation="SearsBeansService_schema2.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/output" schemaLocation="SearsBeansService_schema3.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/input" schemaLocation="SearsBeansService_schema4.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://webservices.sears.com/" schemaLocation="SearsBeansService_schema5.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://www.sterlingcommerce.com/documentation/types" schemaLocation="yfctype.xsd"/>
</xsd:schema>
</types>
<message name="searsGetOrderDetailsForWSCService">
<part element="tns:searsGetOrderDetailsForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderDetailsForWSCServiceResponse">
<part element="tns:searsGetOrderDetailsForWSCServiceResponse" name="parameters"/>
</message>
<message name="XBeanWSException">
<part element="tns:XBeanWSException" name="fault"/>
</message>
<message name="searsGetOrderListForWSCService">
<part element="tns:searsGetOrderListForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderListForWSCServiceResponse">
<part element="tns:searsGetOrderListForWSCServiceResponse" name="parameters"/>
</message>
<portType name="SearsBeans">
<operation name="searsGetOrderDetailsForWSCService">
<input message="tns:searsGetOrderDetailsForWSCService"/>
<output message="tns:searsGetOrderDetailsForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
<operation name="searsGetOrderListForWSCService">
<input message="tns:searsGetOrderListForWSCService"/>
<output message="tns:searsGetOrderListForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
</portType>
<binding name="SearsBeansPortBinding" type="tns:SearsBeans">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="searsGetOrderDetailsForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
<operation name="searsGetOrderListForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
</binding>
<service name="SearsBeansService">
<port binding="tns:SearsBeansPortBinding" name="SearsBeansPort">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
I am able to resolve this issue. I had to remove all the white spaces, comments and question marks (?) from the request (if any).
After that it was working fine. I think, due to the white spaces in request, soapUI was treating it as some kind of request element/value and was unable to convert into SOAPElement.
Hope this would be helpful for others !
Under Request Properties, set "Strip whitespaces" to true. This must be done for each new request. I didn't find a way to set true by default.
Questions marks are placeholders for parameters that must be supplied in your request.
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?
I've created a webservice and used Axis2 to generate all "skeleton" java classes. Then I of course implemented the service operations myself.
In the implementation, I can throw a MyException which is then caught by the generated classes and converted to an AxisFault object, which in turn is converted to a soap fault (deep down in the Axis framework) with the attribute <faultcode>soapenv:Server</faultcode>
My problem is I would like a custom dynamic faultcode, not "soapenv:Server".
I tried to manually create an AxisFault object and throw this, but AxisFault is a RemoteException, and the generated interface which my implementation must implement, does not allow to throw RemoteException.
Is it possible to get some kind of hook or filter on the output, so that I can change the faultcode? Or any other way to control the faultcode?
Thanks in advance
Ulrik
The SOAP specification describes how custom fault information appears under the detail tag. The faultcode is a fixed set of value dealing with where in the SOAP processing the error was thrown.
The following is an example of throwing a custom fault message
WSDL
Declare the faults in your WSDL so that the associated classes are generated:
<wsdl:definitions targetNamespace="http://example"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:tns="http://example"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://example"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:tns="http://example" xmlns:intf="http://example"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<element name="withdraw">
<complexType>
<sequence>
<element name="account" type="xsd:string"/>
<element name="amount" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="withdrawResponse">
<complexType>
<sequence>
<element name="balance" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="AccountNotExistFault">
<complexType>
<sequence>
<element name="account" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="InsufficientFundFault">
<complexType>
<sequence>
<element name="account" type="xsd:string"/>
<element name="balance" type="xsd:int"/>
<element name="requestedFund" type="xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="withdrawRequest">
<wsdl:part element="tns:withdraw" name="parameters"/>
</wsdl:message>
<wsdl:message name="withdrawResponse">
<wsdl:part element="tns:withdrawResponse" name="return"/>
</wsdl:message>
<wsdl:message name="InsufficientFundFaultMessage">
<wsdl:part element="tns:InsufficientFundFault" name="fault"/>
</wsdl:message>
<wsdl:message name="AccountNotExistFaultMessage">
<wsdl:part element="tns:AccountNotExistFault" name="fault"/>
</wsdl:message>
<wsdl:portType name="Bank">
<wsdl:operation name="withdraw">
<wsdl:input message="tns:withdrawRequest" name="withdrawRequest"/>
<wsdl:output message="tns:withdrawResponse" name="withdrawResponse"/>
<wsdl:fault message="tns:AccountNotExistFaultMessage" name="AccountNotExistException"/>
<wsdl:fault message="tns:InsufficientFundFaultMessage" name="InsufficientFundException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BankSoapBinding" type="tns:Bank">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="withdraw">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="withdrawRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="withdrawResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="InsufficientFundException">
<wsdlsoap:fault name="InsufficientFundException" use="literal"/>
</wsdl:fault>
<wsdl:fault name="AccountNotExistException">
<wsdlsoap:fault name="AccountNotExistException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BankService">
<wsdl:port binding="tns:BankSoapBinding" name="Bank">
<wsdlsoap:address location="http://localhost:8080/bank/services/Bank"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Service code
The following code demonstrates how the custom fault messages are thrown:
package example;
public class BankServiceSkeleton {
public WithdrawResponse withdraw(Withdraw param1) throws InsufficientFundFaultMessage, AccountNotExistFaultMessage {
//
// Parameter handling
//
String account = param1.getAccount();
int amount = param1.getAmount();
//
// Error checks
//
if ("13".equals(account)) {
AccountNotExistFault fault = new AccountNotExistFault();
fault.setAccount(account);
AccountNotExistFaultMessage ex = new AccountNotExistFaultMessage("Account does not exist!");
ex.setFaultMessage(fault);
throw ex;
}
if (amount > 1000) {
InsufficientFundFault fault = new InsufficientFundFault();
fault.setAccount(account);
fault.setBalance(1000);
fault.setRequestedFund(amount);
InsufficientFundFaultMessage ex = new InsufficientFundFaultMessage("Insufficient funds");
ex.setFaultMessage(fault);
throw ex;
}
//
// Normal response
//
WithdrawResponse response = new WithdrawResponse();
response.setBalance(1000 - amount);
return response;
}
}
TESTING
The following SOAP message
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://example">
<soapenv:Header/>
<soapenv:Body>
<exam:withdraw>
<exam:account>10</exam:account>
<exam:amount>2000</exam:amount>
</exam:withdraw>
</soapenv:Body>
</soapenv:Envelope>
Generates the following SOAP fault response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>Insufficient funds</faultstring>
<detail>
<ns1:InsufficientFundFault xmlns:ns1="http://example">
<ns1:account>10</ns1:account>
<ns1:balance>1000</ns1:balance>
<ns1:requestedFund>2000</ns1:requestedFund>
</ns1:InsufficientFundFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I am currently trying to use a web service I developed within an Integration Services package. When I try to configure the web service task I keep getting an error message. I configured the HTTP connection, and successfully downloaded the WSDL file which overrides my local copy. After that, on the input tab, I try to select the only service available "MyService" and then get the following error message:
Item has already been added. Key in dictionary: 'anyType' Key being added: 'anyType'
Anyone knows what this means?
Thanks in advance!
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="MyService" targetNamespace="http://www.MyDomain.de/webservices" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://www.MyDomain.de/webservices" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsdl:types>
<xsd:schema targetNamespace="http://www.MyDomain.de/webservices/Imports">
<xsd:import schemaLocation="http://localhost/MyDomainMyService/MyDomain.Billing.Infrastructure.Wcf.MyService.svc?xsd=xsd0" namespace="http://www.MyDomain.de/webservices" />
<xsd:import schemaLocation="http://localhost/MyDomainMyService/MyDomain.Billing.Infrastructure.Wcf.MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="MyService_BookNewTransaction_InputMessage">
<wsdl:part name="parameters" element="tns:BookNewTransaction" />
</wsdl:message>
<wsdl:message name="MyService_BookNewTransaction_OutputMessage">
<wsdl:part name="parameters" element="tns:BookNewTransactionResponse" />
</wsdl:message>
<wsdl:portType name="MyService">
<wsdl:operation name="BookNewTransaction">
<wsdl:input wsaw:Action="http://www.MyDomain.de/webservices/MyService/BookNewTransaction" message="tns:MyService_BookNewTransaction_InputMessage" />
<wsdl:output wsaw:Action="http://www.MyDomain.de/webservices/MyService/BookNewTransactionResponse" message="tns:MyService_BookNewTransaction_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_MyService" type="tns:MyService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="BookNewTransaction">
<soap:operation soapAction="http://www.MyDomain.de/webservices/MyService/BookNewTransaction" 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="MyService">
<wsdl:port name="BasicHttpBinding_MyService" binding="tns:BasicHttpBinding_MyService">
<soap:address location="http://localhost/MyDomainMyService/MyDomain.Billing.Infrastructure.Wcf.MyService.svc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Ok, I found a link describing my problem.
Check this:
http://sjbdeveloper.blogspot.com/2007/03/calling-wcf-web-service-from-ssis-web.html
This should solve the problem:
http://sjbdeveloper.blogspot.com/2007/03/fixing-wcf-ssis-web-service-task.html