Error when using Parameters in Worklight HTTP Adapter - ibm-mobilefirst

Using Worklight 6.2.0.0.
I'm trying to consume one of our corporate web services via Worklight's HTTP Adapter. I have the WSDL for the web service, and I used the "Discover Backend Services" tool to generate the adapter JavaScript and XML.
The web service has 2 input parameters and 3 output parameters, all strings.
When I come to invoke the procedure on the client, I'm doing this:
var invocationData = {
adapter : 'messageHandlerAdapter',
procedure : 'messageHandlerService_messageHandler',
parameters : ['a','b']
};
var invocationOptions = {
onSuccess : messageHandlerSuccess,
onFailure : messageHandlerFailure
};
WL.Client.invokeProcedure(invocationData,invocationOptions);
You can see the dummy parameters in the invocationData array. Running this results in the following error:
java.lang.String cannot be cast to org.mozilla.javascript.Scriptable
If I remove the parameters, I don't get an error and the web service call appears to be successful, but I don't get any response (obviously).
A search on the forums led me to this:
http://stackoverflow.com/questions/23192346/class-cast-java-lang-string-cannot-be-cast-to-org-mozilla-javascript-scriptable
Which is along the same lines, and the response was that there might be an invalid JSON object somewhere. However, all I've done is used the auto-generated adapter code and called it.
I'm very new to Worklight, so any advice is gratefully received!
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="messageHandler" targetNamespace="urn:messageHandler" xmlns:tns="urn:messageHandler" xmlns:S2="urn:messageHandler:messageHandler" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:S1="urn:soap-fault:details" xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation>EncodingType=DOC_LITERAL, WSA_Product=10.1A - N/A</wsdl:documentation>
<wsdl:types>
<schema elementFormDefault="unqualified" targetNamespace="urn:soap-fault:details" xmlns="http://www.w3.org/2001/XMLSchema"><element name="FaultDetail"><complexType><sequence><element name="errorMessage" type="xsd:string"/><element name="requestID" type="xsd:string"/></sequence></complexType></element></schema>
<schema elementFormDefault="qualified" targetNamespace="urn:messageHandler:messageHandler" xmlns="http://www.w3.org/2001/XMLSchema"><element name="messageHandler"><complexType><sequence><element name="ipMessageParams" nillable="true" type="xsd:string"/><element name="ipMessageData" nillable="true" type="xsd:string"/></sequence></complexType></element><element name="messageHandlerResponse"><complexType><sequence><element name="result" nillable="true" type="xsd:string"/><element name="opMessageResponse" nillable="true" type="xsd:string"/><element name="opMessageData" nillable="true" type="xsd:string"/></sequence></complexType></element></schema>
</wsdl:types>
<wsdl:message name="messageHandler_messageHandlerResponse">
<wsdl:part name="parameters" element="S2:messageHandlerResponse"/>
</wsdl:message>
<wsdl:message name="FaultDetailMessage">
<wsdl:part name="FaultDetail" element="S1:FaultDetail"/>
</wsdl:message>
<wsdl:message name="messageHandler_messageHandler">
<wsdl:part name="parameters" element="S2:messageHandler"/>
</wsdl:message>
<wsdl:portType name="messageHandlerObj">
<wsdl:operation name="messageHandler">
<wsdl:input message="tns:messageHandler_messageHandler"/>
<wsdl:output message="tns:messageHandler_messageHandlerResponse"/>
<wsdl:fault name="messageHandlerFault" message="tns:FaultDetailMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="messageHandlerObj" type="tns:messageHandlerObj">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="messageHandler">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="messageHandlerFault">
<soap:fault name="messageHandlerFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="messageHandlerService">
<wsdl:port name="messageHandlerObj" binding="tns:messageHandlerObj">
<documentation></documentation>
<soap:address location="redacted"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is a link to a pic of the Service description in Project Explorer.

Generally we pass XML to SOAP based web services. With the case to worklight we have to convert XML to JSON and pass it to adapter. Considering your input SOAP is like
<a>
<b>value1</b>
<c>value2</c>
</a>
Your JSON for above XML would be
params= {
a:{
b:value1,
c:value2
}
}
So u will have to pass above JSON as parameter
headers={
"SOAPAction": "YOUR ACTION NAME"
}
And so your adapter call will look like this,
var invocationData = {
adapter : 'messageHandlerAdapter',
procedure : 'messageHandlerService_messageHandler',
parameters : [params,headers]
};
var invocationOptions = {
onSuccess : messageHandlerSuccess,
onFailure : messageHandlerFailure
};
WL.Client.invokeProcedure(invocationData,invocationOptions);

You currently have a service under your 'services' folder in your project.
In Project Explorer view right-click on your service and it should show you a sample parameter to be passed to the messageHandlerService_messageHandler procedure:
You can copy this sample JSON and invoke the adapter procedure by pasting and setting the sample values to your desired values:
If you also need to pass custom HTTP headers you should add a comma after the parameter JSON and add another JSON string with the custom headers.

Related

WCF Method with parameter not generating right WSDL

I have a simple service definition:
[ServiceContract]
public interface IInterface12
{
[OperationContract]
void SendInterface12(string appId);
}
which I have implemented in the service as:
public void SendInterface12(string appId)
{
The thing is that the string parameter appId is not showing up. The complete WSDL is here:
<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="Interface12Service">
-<wsdl:types>
-<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import namespace="http://tempuri.org/" schemaLocation="http://localhost/TestInterface12/Interface12Service.svc?xsd=xsd0"/>
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://localhost/TestInterface12/Interface12Service.svc?xsd=xsd1"/>
</xsd:schema>
</wsdl:types>
-<wsdl:message name="IInterface12_SendInterface12_InputMessage">
<wsdl:part name="parameters" element="tns:SendInterface12"/>
</wsdl:message>
-<wsdl:message name="IInterface12_SendInterface12_OutputMessage">
<wsdl:part name="parameters" element="tns:SendInterface12Response"/>
</wsdl:message>
-<wsdl:portType name="IInterface12">
-<wsdl:operation name="SendInterface12">
<wsdl:input message="tns:IInterface12_SendInterface12_InputMessage" wsaw:Action="http://tempuri.org/IInterface12/SendInterface12"/>
<wsdl:output message="tns:IInterface12_SendInterface12_OutputMessage" wsaw:Action="http://tempuri.org/IInterface12/SendInterface12Response"/>
</wsdl:operation>
</wsdl:portType>
-<wsdl:binding name="BasicHttpBinding_IInterface12" type="tns:IInterface12">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
-<wsdl:operation name="SendInterface12">
<soap:operation style="document" soapAction="http://tempuri.org/IInterface12/SendInterface12"/>
-<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
-<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-<wsdl:service name="Interface12Service">
-<wsdl:port name="BasicHttpBinding_IInterface12" binding="tns:BasicHttpBinding_IInterface12">
<soap:address location="http://localhost/TestInterface12/Interface12Service.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
What am I missing? I have to have a service operation that takes a parameter but when I generate the proxy, there is no parameter for the string appId parameter. It says it takes 0 parameters.
Most probably the WSDL references an XSD file where your parameter is defined. Search for "import" or "include" to see the location of that XSD. If this is your wsdl location: http://myserver.com/X.svc?WSDL=WSDL0 then the XSD is in http://myserver.com/x.svc?XSD=XSD0 (or XSD1, XSD2...). Possibly your WSDL references another WSDL (WSDL1) which is the one that references the XSD (or a few of them).

wsdl has unresolved urls. Service proxy returns null

I am trying to connect to an external webservice and have no control over it.
The wsdl has a few unresolved urls. Neither Soap UI not svcutil were able to make any use out of it.
So I browsed to this wsdl and did a 'Save As' to a xml document. Then I went and manually changed it these few to the correct one.
For eg:
https://b2borexatest.oracleoutsourcing.com/soa-infra/services/default/MMISSOAPRequestReceiver!1.0*soa_d48cf4e0-5e7b-43ad-b430-727180d48841/RouteEDITransactions_ep?WSDL. T
This was the original webservice Wsdl given. and then they changed it to
https://orserviceb2btest.oracleoutsourcing.com/soa-infra/services/default/MMISSOAPRequestReceiver!1.0/CORERule220.wsdl
I am able to browse to the second url but it still contains some traces of the old one 'b2b....'
So I went and manually changed these traces to reflect to the correct one.
By doing so, I was able to create a proxy using svcutil.
Question: Could this be the possible reason for getting a webservice proxy returns null
SOAP UI request
<soapenv:Envelope xmlns:cor="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<cor:COREEnvelopeRealTimeRequest>
<PayloadType>123</PayloadType>
<ProcessingMode>XXX</ProcessingMode>
<PayloadID>72</PayloadID>
<TimeStamp>2013-07-13:T23:30:29:45</TimeStamp>
<SenderID>MID</SenderID>
<ReceiverID>OID</ReceiverID>
<CORERuleVersion>2.2.0</CORERuleVersion>
<Payload>MY Input string</Payload>
</cor:COREEnvelopeRealTimeRequest>
</soapenv:Body>
This is the working SOAP UI response
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Body>
<COREEnvelopeRealTimeResponse xmlns:cor="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" xmlns="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd">
<cor:PayloadType>XXX</cor:PayloadType>
<cor:ProcessingMode>23</cor:ProcessingMode>
<cor:PayloadID>372</cor:PayloadID>
<cor:TimeStamp>2013-08-04T23:38:32.083-05:00</cor:TimeStamp>
<cor:SenderID>OID</cor:SenderID>
<cor:ReceiverID>RID</cor:ReceiverID>
<cor:CORERuleVersion>2.2.0</cor:CORERuleVersion>
<cor:Payload>Response String</cor:Payload>
<cor:ErrorCode>Success</cor:ErrorCode>
<cor:ErrorMessage></cor:ErrorMessage>
</COREEnvelopeRealTimeResponse>
</env:Body>
I don't see any conflictions in the request/response
These are some relevant pieces of the wsdl
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions xmlns:CORE="http://www.caqh.org/SOAP/WSDL/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:CORE-XSD="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" xmlns="http://schemas.xmlsoap.org/wsdl/" name="CORE" targetNamespace="http://www.caqh.org/SOAP/WSDL/">
<wsdl:types>
<xsd:schema xmlns="http://schemas.xmlsoap.org/wsdl/" elementFormDefault="qualified" targetNamespace="http://www.caqh.org/SOAP/WSDL/">
<xsd:import namespace="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" schemaLocation="xsd/CORERule2.2.0.xsd"></xsd:import>
</xsd:schema>
</wsdl:types>
<wsdl:message name="RealTimeRequestMessage">
<wsdl:part name="body" element="CORE-XSD:COREEnvelopeRealTimeRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="RealTimeResponseMessage">
<wsdl:part name="body" element="CORE-XSD:COREEnvelopeRealTimeResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CORETransactions">
<wsdl:operation name="RealTimeTransaction">
<wsdl:input message="CORE:RealTimeRequestMessage"></wsdl:input>
<wsdl:output message="CORE:RealTimeResponseMessage"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CoreSoapBinding" type="CORE:CORETransactions">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap12:binding>
<wsdl:operation name="RealTimeTransaction">
<soap12:operation soapAction="RealTimeTransaction" 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:operation>
I don't see where the proxy class could loose it although Fiddler captures the correct response.
This is a piece of where I invoke the service method using proxy client class
var ORrealTimeTrans = new COREEnvelopeRealTimeRequest()
{
PayloadType = "blabla",
ProcessingMode = bla,
PayloadID = bla,
CORERuleVersion = bla,
SenderID = sid,
ReceiverID = rid,
TimeStamp = DateTime.UtcNow.ToString("yyyy-MM-ddThh:mm:22Z"),
Payload = input
};
_ORclient.ClientCredentials.UserName.UserName = UserID;
_ORclient.ClientCredentials.UserName.Password = Password;
var resp = _ORclient.RealTimeTransaction(ORrealTimeTrans);
THis one _ORclient.RealTimeTransaction(ORrealTimeTrans) comes out null.
Could it be possible that I've changed some occurences of b2b to orservice and this proxy returns null?
Please suggest

WCF Universal service contract and WS-Interoperability compliance

Microsoft MSDN describes the most universal service contract for a request reply operation as
[ServiceContract]
public interface IUniversalRequestReply
{
[OperationContract(Action="*", ReplyAction="*")]
Message ProcessMessage(Message msg);
}
If I make a contract like the one below, using basicHttp binding, it will not be WS-I compliant (using SOAPUI compliance check).
[OperationContract]
Message SomeOperation(Message msg);
I would think the most universal contract also would be the most interoperable.
Can anyone explain why it is not WS-I compliant? And more importantly - will using the Message class make the service less consumable to Java clients?
Any experience using the Message class is appreciated.
EDIT After first answer:
This is the full WSDL showing the service contract and operation contract.
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns="http://tempuri.org/" 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:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="UniversalRequestReply" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:52437/UniversalRequestReply.svc?xsd=xsd0" namespace="http://schemas.microsoft.com/Message"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IUniversalRequestReply_SomeOperation_InputMessage">
<wsdl:part xmlns:q1="http://schemas.microsoft.com/Message" name="msg" type="q1:MessageBody"/>
</wsdl:message>
<wsdl:message name="IUniversalRequestReply_SomeOperation_OutputMessage">
<wsdl:part xmlns:q2="http://schemas.microsoft.com/Message" name="SomeOperationResult" type="q2:MessageBody"/>
</wsdl:message>
<wsdl:portType name="IUniversalRequestReply">
<wsdl:operation name="SomeOperation">
<wsdl:input wsaw:Action="http://tempuri.org/IUniversalRequestReply/SomeOperation" message="tns:IUniversalRequestReply_SomeOperation_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IUniversalRequestReply/SomeOperationResponse" message="tns:IUniversalRequestReply_SomeOperation_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IUniversalRequestReply" type="tns:IUniversalRequestReply">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SomeOperation">
<soap:operation soapAction="http://tempuri.org/IUniversalRequestReply/SomeOperation" 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="UniversalRequestReply">
<wsdl:port name="BasicHttpBinding_IUniversalRequestReply" binding="tns:BasicHttpBinding_IUniversalRequestReply">
<soap:address location="http://localhost:52437/UniversalRequestReply.svc/basic"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
What the WSI Compliance test fails is not a missing service contract, but the Message input itself:
Name of message that failed: {http://tempuri.org/}IUniversalRequestReply_SomeOperation_InputMessage
Message: name={http://tempuri.org/}IUniversalRequestReply_SomeOperation_InputMessage
Part: name=msg
typeName={http://schemas.microsoft.com/Message}MessageBody
So using this Message class is not WS-I compliant of some reason.
The reason is the service is not complaint is because it does not define any service contract. Universal means this service can consume the soap message generated by any client that calls it. It does not attempt to deserialize the soap message because it never defines a contract of its own. WS-I compliance requires that a service define a static contract that can be expressed in WSDL.

How do I create a proxy class in .NET using a WSDL File?

I have been trying to generate a Proxy class in VB.NET using a WSDL file for an Apache Axis SOAP Web Service.
They have provided me the WSDL file and when I use the WSDL.exe command (In Visual Studio 08) and point it to the local path I get an error.
wsdl /language:vb c:\Orders.wsdl
(I am trying to create a .NET Client that consumes the SOAP Web Service Hosted on Apache Axis 2)
The Error
Unable to import binding 'OrdersSoapBinding' from namespace 'urn:company:orders:schemas:OrderTypes:1.00'.
-Unable to import operation 'placeOrder'
-The element 'urn:company:remtp:schemas:PlaceOrderRequest:1.00:PlaceOrderRequest' is missing
if you would like more help, please type 'wsdl /?'
If I use the svcutil.exe I also get an error message...
svcutil.exe C:\Orders.wsdl /t:code /l:VB /o:"C:\Orders.VB"
What is causing the problem?
Your help will be much appreciated, Thank you.
WSDL Code
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="urn:company:orders:schemas:OrderTypes:1.00"
xmlns:impl="urn:company:orders:schemas:OrderTypes:1.00"
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/"
xmlns:poreq="urn:company:remtp:schemas:PlaceOrderRequest:1.00"
xmlns:poresp="urn:company:remtp:schemas:PlaceOrderResponse:1.00"
xmlns:coreq="urn:company:remtp:schemas:CommitOrderRequest:1.00"
xmlns:coresp="urn:company:remtp:schemas:CommitOrderResponse:1.00"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:company:orders:schemas:OrderTypes:1.00">
<import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="placeOrderRequest">
<wsdl:part element="poreq:PlaceOrderRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="placeOrderResponse">
<wsdl:part element="poresp:PlaceOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="commitOrderRequest">
<wsdl:part element="coreq:CommitOrderRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="commitOrderResponse">
<wsdl:part element="coresp:CommitOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Orders">
<wsdl:operation name="placeOrder">
<wsdl:input message="impl:placeOrderRequest"/>
<wsdl:output message="impl:placeOrderResponse"/>
</wsdl:operation>
<wsdl:operation name="commitOrder">
<wsdl:input message="impl:commitOrderRequest"/>
<wsdl:output message="impl:commitOrderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OrdersSoapBinding" type="impl:Orders">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="placeOrder">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="placeOrderRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="placeOrderResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="commitOrder">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="commitOrderRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="commitOrderResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrdersService">
<wsdl:port name="Orders" binding="impl:OrdersSoapBinding">
<wsdlsoap:address location="https://companyorders.co.uk/endpoints/services/Orders"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Looking into the wsdl file you provided, You'll see references to four xsd (xml xchema document) files: they contain the type definitions and validation rules needed by svcutil to create the proxy.
<import namespace="urn:company:remtp:schemas:PlaceOrderRequest:1.00" schemaLocation="../schemas/placeOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:PlaceOrderResponse:1.00" schemaLocation="../schemas/placeOrderResponse.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderRequest:1.00" schemaLocation="../schemas/commitOrderRequest.xsd"/>
<import namespace="urn:company:remtp:schemas:CommitOrderResponse:1.00" schemaLocation="../schemas/commitOrderResponse.xsd"/>
So, You need those xsd files too

svcutil soap fault namespace problem

I'm generating client side web service code using svcutil. The wsdl contract I'm using contains a soap fault. When the code is generated the fault seems to be wrapped in the namespace it was defined in the contract.
Can anyone explain why?
I'm simply running svcutil [filename]
Example WSDL:
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="HelloFault">
<s:complexType/>
</s:element>
<s:element name="HelloWorld">
<s:complexType/>
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld"/>
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse"/>
</wsdl:message>
<wsdl:message name="NewMessage">
<wsdl:part name="detail" element="tns:HelloFault"/>
</wsdl:message>
<wsdl:portType name="Service1Soap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn"/>
<wsdl:output message="tns:HelloWorldSoapOut"/>
<wsdl:fault name="FaultName" message="tns:NewMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Service1Soap12" type="tns:Service1Soap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="HelloWorld">
<soap12:operation soapAction="http://tempuri.org/HelloWorld" soapActionRequired="" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="FaultName">
<soap12:fault name="FaultName" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
Generates:
namespace tempuri.org
{
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="HelloFault", Namespace="http://tempuri.org/")]
public partial class HelloFault : object, System.Runtime.Serialization.IExtensibleDataObject
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
}
}
But other types declared in the contract are declared without a namespace?
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class HelloWorldRequest
{
...
You have to use the /UseSerializerForFaults attribute on svcutil, this will cause the XmlSerializer to be used for reading and writing faults (but only those), instead of the default DataContractSerializer (which will still be used for the rest of the stuff).
This seems to be a genuine bug - more info on my blog post.
I'm not sure I understand what the problem is... can you clarify?
From the looks of it, it would seem WCF is doing the right thing... the generated class has the right namespace URI in the [DataContract] attribute according to the schema in the WSDL fragment you showed.
What were you expecting?
Update: OK, I see what you're saying, but in this specific case, it's not unexpected either. If you look closely, notice that the other class you mention (HelloWorldRequest) is a Message Contract, not a DataContract. Message Contracts don't have namespaces themselves, though they can specify a namespace for the wrapper element around the message body (see the WrapperNamespace property).
In your case, the message contract specifies that it is not wrapped, so the WrapperNamespace wouldn't apply anyway.
Update #2: Regarding the CLR namespace (and not the XML namespace URI), SvcUtil does give you a way to control that; check out the /namespace: argument in the documentation.