Service parameter always null, but I can see it in the trace - wcf

I'm having trouble implementing a service based off of a third-party wsdl. The third-party calls into my service and I can see the data in the trace, but my service parameters keep ending up null after deserialization.
As you can see from the trace, the alertXML node contains a XML document as a string. In the service code, this alertXML string is always null. Is there some special processing I need to do to handle this XML-as-a-string scenario?
Barring that, is there any way for me to just get a hold of the whole envelope so that I can parse the thing out?
Thanks
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>0</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2011-07-08T17:46:14.7804786Z" />
<Source Name="System.ServiceModel.MessageLogging" />
<Correlation ActivityID="{54a3d088-5393-45a7-ae97-0bcd636f1750}" />
<Execution ProcessName="w3wp" ProcessID="3468" ThreadID="17" />
<Channel/>
<Computer>COMPUTER</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<MessageLogTraceRecord Time="2011-07-08T13:46:14.7804786-04:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<HttpRequest>
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<Content-Length>1807</Content-Length>
<Content-Type>text/xml; charset=utf-8</Content-Type>
<Expect>100-continue</Expect>
<Host>host</Host>
<User-Agent>Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3623)</User-Agent>
<SOAPAction>"http://www.xyz.com/wsdl/ProcessXML"</SOAPAction>
</WebHeaders>
</HttpRequest>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ProcessXML xmlns="http://www.xyz.com/wsdl/">
<alertXml><?xml version="1.0" encoding="UTF-8"?><XMLOutgoing>MORE XML STRING</XMLOutgoing></alertXml>
</ProcessXML>
</soap:Body>
</soap:Envelope>
</MessageLogTraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
EDIT:
The wsdl is:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.xyz.com/wsdl/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.xyz.com/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.xyz.com/wsdl/">
<s:element name="ProcessXML">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="alertXml" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ProcessXMLResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ProcessXMLResult">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="ProcessXMLSoapIn">
<wsdl:part name="parameters" element="tns:ProcessXML"/>
</wsdl:message>
<wsdl:message name="ProcessXMLSoapOut">
<wsdl:part name="parameters" element="tns:ProcessXMLResponse"/>
</wsdl:message>
<wsdl:message name="ProcessXMLHttpGetIn">
<wsdl:part name="alertXml" type="s:string"/>
</wsdl:message>
<wsdl:message name="ProcessXMLHttpGetOut">
<wsdl:part name="Body"/>
</wsdl:message>
<wsdl:message name="ProcessXMLHttpPostIn">
<wsdl:part name="alertXml" type="s:string"/>
</wsdl:message>
<wsdl:message name="ProcessXMLHttpPostOut">
<wsdl:part name="Body"/>
</wsdl:message>
<wsdl:portType name="GenericServiceSoap">
<wsdl:operation name="ProcessXML">
<wsdl:input message="tns:ProcessXMLSoapIn"/>
<wsdl:output message="tns:ProcessXMLSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="GenericServiceHttpGet">
<wsdl:operation name="ProcessXML">
<wsdl:input message="tns:ProcessXMLHttpGetIn"/>
<wsdl:output message="tns:ProcessXMLHttpGetOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="GenericServiceHttpPost">
<wsdl:operation name="ProcessXML">
<wsdl:input message="tns:ProcessXMLHttpPostIn"/>
<wsdl:output message="tns:ProcessXMLHttpPostOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GenericServiceSoap" type="tns:GenericServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ProcessXML">
<soap:operation soapAction="http://www.xyz.com/wsdl/ProcessXML" 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="GenericServiceSoap12" type="tns:GenericServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ProcessXML">
<soap12:operation soapAction="http://www.xyz.com/wsdl/ProcessXML" 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="GenericServiceHttpGet" type="tns:GenericServiceHttpGet">
<http:binding verb="GET"/>
<wsdl:operation name="ProcessXML">
<http:operation location="/ProcessXML"/>
<wsdl:input>
<http:urlEncoded/>
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="GenericServiceHttpPost" type="tns:GenericServiceHttpPost">
<http:binding verb="POST"/>
<wsdl:operation name="ProcessXML">
<http:operation location="/ProcessXML"/>
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded"/>
</wsdl:input>
<wsdl:output>
<mime:content part="Body" type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GenericService">
</wsdl:service>
</wsdl:definitions>
The skeleton of the service code is:
Public Function ProcessXML(request As ProcessXMLRequest) As ProcessXMLResponse Implements GenericServiceSoap.ProcessXML
'request.Body is a non-null object but request.Body.alertXml is null
End Function

To send XML as a parameter or a property in a DataContract in WCF you need to use XmlElement for the .NET type of the parameter or property. Based on the WSDL in the question, the alertXml will be serialized as a string not XML by WCF. Here is what the WSDL for an XML operation parameter would look like:
<xs:element name="alertXml" nillable="true" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
To see what all the WSDL should look like, implement a service like this:
[ServiceContract]
public interface IService1
{
[OperationContract]
string ProcessXml(XmlElement alertXml);
[OperationContract]
string ProcessSomeXml(ProcessXMLRequest xmlRequest);
}
[DataContract]
public class ProcessXMLRequest
{
public XmlElement someXml { get; set; }
}
//Service implementation
public class Service1 : IService1
{
public string ProcessXml(XmlElement alertXml)
{
XmlNode xmlToProcess = GetXmlToProcess(alertXml);
return string.Format("You entered: {0}", xmlToProcess.InnerText);
}
public string ProcessSomeXml(ProcessXMLRequest xmlRequest)
{
XmlNode xmlToProcess = GetXmlToProcess(xmlRequest.someXml);
return string.Format("You entered some: {0}", xmlToProcess.InnerText);
}
private XmlNode GetXmlToProcess(XmlElement alertXml)
{
var xmlToProcess = alertXml as XmlNode;
if (xmlToProcess == null)
{
var x = new XmlDocument();
x.LoadXml("<root>XML was null</root>");
xmlToProcess = x;
}
return xmlToProcess;
}
}

Related

Why does Azure give me a 500 error when running HelloWorld?

I created a SOAP service in .Net standard using Visual Studio 2019, see code below
The service has a HelloWorld function which correctly returns "Hello World" when queried using Postman (see query below)
I copy the WSDL for my service and save it as a .wsdl on my desktop (see WSDL below)
I successfully upload the WSDL to Azure in API Management
When running the HelloWorld function, I get a 500 error. Why is this?
Service.asmx:
Imports System.Web.Services
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://mynamespace.com/")>
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
POST (http://localhost:58904/Service.asmx/HelloWorld) (returns "Hello World")
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<HelloWorld xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mynamespace.com/" />
</Body>
</Envelope>
WSDL
<wsdl:definitions 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://mynamespace.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 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://mynamespace.com/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://mynamespace.com/">
<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:portType name="ServiceSoap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn"/>
<wsdl:output message="tns:HelloWorldSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://mynamespace.com/HelloWorld" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="HelloWorld">
<soap12:operation soapAction="http://mynamespace.com/HelloWorld" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="https://localhost:44380/Service.asmx"/>
</wsdl:port>
<wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="https://localhost:44380/Service.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Error
Unable to connect to the remote server
BackendConnectionFailure
Failed method: forward-request

How do i add soapHeader to service built in asp.net core

I built a service in asp.net core which is accessible via wsdl below. I want to add authheader to this wsdl. How do i achieve this? I am able to test this service using Postman with success. I used below code to make it look like a soap service.
app.UseSoapEndpoint<SampleService>("/webservice/SS.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer);
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="SampleService">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
<xs:element name="Test">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="TestResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="TestResult" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="SampleService_Test_InputMessage">
<wsdl:part name="parameters" element="tns:Test"/>
</wsdl:message>
<wsdl:message name="SampleService_Test_OutputMessage">
<wsdl:part name="parameters" element="tns:TestResponse"/>
</wsdl:message>
<wsdl:portType name="SampleService">
<wsdl:operation name="Test">
<wsdl:input message="tns:SampleService_Test_InputMessage"/>
<wsdl:output message="tns:SampleService_Test_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_SampleService" type="tns:SampleService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Test">
<soap:operation soapAction="http://tempuri.org/SampleService/Test" 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="SampleService">
<wsdl:port name="BasicHttpBinding_SampleService" binding="tns:BasicHttpBinding_SampleService">
<soap:address location="http://localhost:32156/webservice/SS.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Where is the request model in this vendor WSDL?

I'm attempting to create user accounts for a vendor tool in batches. I asked the vendor how to turn on the MEX for the endpoint for creating a single account and I adjusted the config file accordingly.
I was able to create a service reference, but all I have in Visual Studio is a client and two interfaces. I can't tell how to create a request. The client has an InvokeService method, but it just takes an object.
I replicated the vendors class structure in my code, but then the service didn't like my type. So, I updated the classes to use the vendor's original namespace, but the service still didn't like it.
Type 'life.businessService.baseBusinessDataModel.BusinessRequest' with data contract name 'BusinessRequest:http://schemas.datacontract.org/2004/07/life.businessService.baseBusinessDataModel' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Here's the WSDL from the service. I'm not very strong in WCF, so I'm hoping for some guidance. Thanks!
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 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" name="ClientWcfBusinessFacadeService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsp:Policy wsu:Id="NetNamedPipeBinding_IWcfBusinessFacade_policy">
<wsp:ExactlyOne>
<wsp:All>
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
</msb:BinaryEncoding>
<wsaw:UsingAddressing>
</wsaw:UsingAddressing>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="NetTcpBinding_IWcfBusinessFacade_policy">
<wsp:ExactlyOne>
<wsp:All>
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
</msb:BinaryEncoding>
<wsaw:UsingAddressing>
</wsaw:UsingAddressing>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import namespace="http://tempuri.org/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="IWcfBusinessFacade_InvokeService_InputMessage">
<wsdl:part name="parameters" element="tns:InvokeService" />
</wsdl:message>
<wsdl:message name="IWcfBusinessFacade_InvokeService_OutputMessage">
<wsdl:part name="parameters" element="tns:InvokeServiceResponse" />
</wsdl:message>
<wsdl:message name="IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage">
<wsdl:part xmlns:q1="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" name="detail" element="q1:ServiceFault" />
</wsdl:message>
<wsdl:portType name="IWcfBusinessFacade">
<wsdl:operation name="InvokeService">
<wsdl:input wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeService" message="tns:IWcfBusinessFacade_InvokeService_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceResponse" message="tns:IWcfBusinessFacade_InvokeService_OutputMessage" />
<wsdl:fault wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceServiceFaultFault" name="ServiceFaultFault" message="tns:IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NetNamedPipeBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
<wsp:PolicyReference URI="#NetNamedPipeBinding_IWcfBusinessFacade_policy">
</wsp:PolicyReference>
<soap12:binding transport="http://schemas.microsoft.com/soap/named-pipe" />
<wsdl:operation name="InvokeService">
<soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="NetTcpBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
<wsp:PolicyReference URI="#NetTcpBinding_IWcfBusinessFacade_policy">
</wsp:PolicyReference>
<soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
<wsdl:operation name="InvokeService">
<soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ClientWcfBusinessFacadeService">
<wsdl:port name="NetNamedPipeBinding_IWcfBusinessFacade" binding="tns:NetNamedPipeBinding_IWcfBusinessFacade">
<soap12:address location="net.pipe://localhost/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.pipe://localhost/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="NetTcpBinding_IWcfBusinessFacade" binding="tns:NetTcpBinding_IWcfBusinessFacade">
<soap12:address location="net.tcp://localhost:8086/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.tcp://localhost:8086/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="NetTcpBinding_IWcfBusinessFacade1" binding="tns:NetTcpBinding_IWcfBusinessFacade">
<soap12:address location="net.tcp://localhost:10000/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.tcp://localhost:10000/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
For the input message of the InvokeService method, you need to pass the object defined in tns:InvokeService. It will be a type in namespace http://tempuri.org/Imports, but is not explicitly exposed in this WSDL; it is coming from another namespace. You may ask the vendor for the schema XSD or assembly from which this WSDL is expecting to import types below since no absolute or even relative schemaLocation attribute is included
<xsd:import namespace="http://tempuri.org/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />

WCF Service reference generates code for SOAP 1.1, not for SOAP1.2

I've received a WSDL which contains the reference for both SOAP 1.1 & SOAP 1.2, since the server supports both SOAP 1.1 & 1.2
However, I would like to use SOAP 1.2 for my client purpose. But when I try to generate the Service reference using Visual Studio, it generates the reference for only 1.1. Is there a way to force generation of 1.2 reference?
Following is the wsdl which I have received:
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="MyTestInfo">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SirName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="MyTestInfoResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="MyTestInfoResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="MyTestInfoSoapIn">
<wsdl:part name="parameters" element="tns:MyTestInfo" />
</wsdl:message>
<wsdl:message name="MyTestInfoSoapOut">
<wsdl:part name="parameters" element="tns:MyTestInfoResponse" />
</wsdl:message>
<wsdl:portType name="MyTestSoap">
<wsdl:operation name="MyTestInfo">
<wsdl:input message="tns:MyTestInfoSoapIn" />
<wsdl:output message="tns:MyTestInfoSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyTestSoap" type="tns:MyTestSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="MyTestInfo">
<soap:operation soapAction="http://tempuri.org/MyTestInfo" 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="MyTestSoap12" type="tns:MyTestSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="MyTestInfo">
<soap12:operation soapAction="http://tempuri.org/MyTestInfo" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyTest">
<wsdl:port name="MyTestSoap" binding="tns:MyTestSoap">
<soap:address location="http://testServer.com/MyTest.asmx" />
</wsdl:port>
<wsdl:port name="MyTestSoap12" binding="tns:MyTestSoap12">
<soap12:address location="http://testServer/MyTest.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Problems importing WSDL using WCF

I'm trying with WCF to import WSDL for a web service provided by one of my company's partners. The web service is written in Java. I get this error:
Warning: Fault named FooException in operation getUnits cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute.
Well, not actually an error, but in the generated code FooException is ignored. FooException contains an error code which I really need.
I've shortened the WSDL and only kept one of the methods. I've also renamed some things (like the exception).
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:testws.foo.se"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:testws.foo.se"
xmlns:intf="urn:testws.foo.se"
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 created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="urn:testws.foo.se" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_soapenc_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="FooException">
<sequence>
<element name="errorCode" nillable="true" type="soapenc:string"/>
<element name="errorDescription" nillable="true" type="soapenc:string"/>
<element name="variables" nillable="true" type="impl:ArrayOf_soapenc_string"/>
</sequence>
</complexType>
<element name="FooException" type="impl:FooException" nillable="true" />
<complexType name="WsUnit">
<sequence>
<element name="id" nillable="true" type="soapenc:string"/>
<element name="name" nillable="true" type="soapenc:string"/>
</sequence>
</complexType>
<complexType name="ArrayOfWsUnit">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="impl:WsUnit[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getUnitsRequest">
</wsdl:message>
<wsdl:message name="getUnitsResponse">
<wsdl:part name="getUnitsReturn" type="impl:ArrayOfWsUnit"/>
</wsdl:message>
<wsdl:message name="FooException">
<wsdl:part name="fault" type="impl:FooException"/>
</wsdl:message>
<wsdl:portType name="MyTest">
<wsdl:operation name="getUnits">
<wsdl:input message="impl:getUnitsRequest" name="getUnitsRequest"/>
<wsdl:output message="impl:getUnitsResponse" name="getUnitsResponse"/>
<wsdl:fault message="impl:FooException" name="FooException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyTestSoapBinding" type="impl:MyTest">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getUnits">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getUnitsRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:testws.foo.se" use="encoded"/>
</wsdl:input>
<wsdl:output name="getUnitsResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:testws.foo.se" use="encoded"/>
</wsdl:output>
<wsdl:fault name="FooException">
<wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="FooException" namespace="urn:testws.foo.se" use="encoded"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyTestService">
<wsdl:port binding="impl:MyTestSoapBinding" name="MyTest">
<wsdlsoap:address location="http://localhost:8080/axis/services/MyTest"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I've tried to just change "type" to "element" in the message part for FooException, but it results in errors. What more do I need to do?