To show my problem I created a simple WCF service with operations that use a message class with [MessageContract] attribute. This message contains the MyHeader property and is annotated with the [MessageHeader] attribute.
[MessageContract] public class HeaderedMessage
{
[MessageHeader] public string MyHeader { get; set; }
}
[ServiceContract] public interface IService
{
[OperationContract] void GetDataUsingDataContract(HeaderedMessage headered);
}
public class Service : IService
{
public void GetDataUsingDataContract(HeaderedMessage headered) { }
}
Then I tried to generate the proxy classes for Silverlight 4 (or 5) using SlSvcUtil.exe:
slsvcutil.exe http://localhost:8732/Design_Time_Addresses/MessageHeaderedService/?wsdl
Without any warning the message headers are totally ignored in the generated classes. Hence the HeaderedMessage does not contain any property at all.
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="HeaderedMessage", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class HeaderedMessage
{
public HeaderedMessage()
{
}
}
I did not find any information at MSDN or through Google search about this weired behaviour. Has anybody else issues with this?
I also tried to use Portable Class Libraries extension to use the IService contract directly through ChannelFactory within the Silverlight application. As the System.ServiceModel assemblies of Silverlight don't contain the MessageHeaderAttribute class it cannot be compiled.
Update: Missing generated WSDL and the WCF System.ServiceModel section:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" 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:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="Service" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8732/Design_Time_Addresses/MessageHeaderedService/?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:8732/Design_Time_Addresses/MessageHeaderedService/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="HeaderedMessage">
<wsdl:part name="parameters" element="tns:HeaderedMessage"/>
</wsdl:message>
<wsdl:message name="HeaderedMessage_Headers">
<wsdl:part name="MyHeader" element="tns:MyHeader"/>
</wsdl:message>
<wsdl:message name="IService_GetDataUsingDataContract_OutputMessage"/>
<wsdl:portType name="IService">
<wsdl:operation name="GetDataUsingDataContract">
<wsdl:input wsaw:Action="http://tempuri.org/IService/GetDataUsingDataContract" name="HeaderedMessage" message="tns:HeaderedMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IService/GetDataUsingDataContractResponse" message="tns:IService_GetDataUsingDataContract_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IService" type="tns:IService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetDataUsingDataContract">
<soap:operation soapAction="http://tempuri.org/IService/GetDataUsingDataContract" style="document"/>
<wsdl:input name="HeaderedMessage">
<soap:header message="tns:HeaderedMessage_Headers" part="MyHeader" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="BasicHttpBinding_IService" binding="tns:BasicHttpBinding_IService">
<soap:address location="http://localhost:8732/Design_Time_Addresses/MessageHeaderedService/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The WCF config:
<system.serviceModel>
<services>
<service name="MessageHeaderedService.Service">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8732/Design_Time_Addresses/MessageHeaderedService/" />
</baseAddresses>
</host>
<endpoint address ="" binding="basicHttpBinding" contract="MessageHeaderedService.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Related
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
I have build a wcf-service (vb.Net with VisualStudio2017) that works well with a testclient, and wcfstorm. SOAPUI can load the wsdl, but when sending a request, it fails with "a:ActionNotSupported"
My Service uses WsHttpbinding, no authentification, no security, with sessions and reliable messaging.
Messagetracing shows that my TestClient succeds with using
< CreateSequence xmlns="http://schemas.xmlsoap.org/ws/2005/02/rm">
where as SOAPUI fails with using
< wsa:Action>http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence< /wsa:Action>
My Questions:
How can i configure my Service to understand/accept the second schema?
I'm a bit puzzled, from what i understand it should already speak SOAP 1.2
How can i get SOAPUI to use a different schema? - or configure the request so it'll work?
SOAPUI-Message
<MessageLogTraceRecord>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence</wsa:Action>
<wsa:MessageID>uuid:f610452d-80ef-4439-9cc1-40c7a1731eac</wsa:MessageID>
<wsa:To>http://rmwebservice:8733/TestService</wsa:To>
</soap:Header>
<soap:Body xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702">
<wsrm:CreateSequence>
<wsrm:AcksTo xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous?id=64f9580f-bfe9-4bd2-9b34-db88e0a5c982</wsa:Address>
</wsrm:AcksTo>
</wsrm:CreateSequence>
</soap:Body>
</soap:Envelope>
</MessageLogTraceRecord>
Response:
<MessageLogTraceRecord>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
<a:RelatesTo>uuid:f610452d-80ef-4439-9cc1-40c7a1731eac</a:RelatesTo>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value>a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="de-DE">Die Aktion http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence wird von diesem Endpunkt nicht unterstützt. Durch diesen Endpunkt werden nur Nachrichten verarbeitet, die der Spezifikation für WS-ReliableMessaging vom Februar 2005 entsprechen.</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
relevant service config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="myBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://myService:8733/" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="reliableBinding">
<reliableSession ordered="true" enabled="true" />
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="TestSoapService.TestService"
behaviorConfiguration="myBehavior">
<endpoint address="http://myService:8733/TestService"
binding="wsHttpBinding"
bindingConfiguration="reliableBinding"
contract="TestSoapService.ITestService" />
<endpoint address="http://myService:8733/mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
wsdl:
<?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="TestService">
<wsp:Policy wsu:Id="WSHttpBinding_ITestService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
<wsrm:InactivityTimeout Milliseconds="600000"/>
<wsrm:AcknowledgementInterval Milliseconds="200"/>
</wsrm:RMAssertion>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import namespace="http://tempuri.org/" schemaLocation="http://rmwebservice:8733/?xsd=xsd0"/>
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://rmwebservice:8733/?xsd=xsd1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ITestService_Echo_InputMessage">
<wsdl:part name="parameters" element="tns:Echo"/>
</wsdl:message>
<wsdl:message name="ITestService_Echo_OutputMessage">
<wsdl:part name="parameters" element="tns:EchoResponse"/>
</wsdl:message>
<wsdl:portType name="ITestService" msc:usingSession="true">
<wsdl:operation name="Echo" msc:isTerminating="false" msc:isInitiating="true">
<wsdl:input message="tns:ITestService_Echo_InputMessage" wsaw:Action="http://tempuri.org/ITestService/Echo"/>
<wsdl:output message="tns:ITestService_Echo_OutputMessage" wsaw:Action="http://tempuri.org/ITestService/EchoResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding type="tns:ITestService" name="WSHttpBinding_ITestService">
<wsp:PolicyReference URI="#WSHttpBinding_ITestService_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Echo">
<soap12:operation style="document" soapAction="http://tempuri.org/ITestService/Echo"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl:port name="WSHttpBinding_ITestService" binding="tns:WSHttpBinding_ITestService">
<soap12:address location="http://rmwebservice:8733/TestService"/>
<wsa10:EndpointReference>
<wsa10:Address>http://rmwebservice:8733/TestService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
While your error is in German and Google likely made a mess of translating it, it states
The action http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence is not supported by this endpoint. This endpoint only processes messages that meet the February 2005 WS-ReliableMessaging specification.
The suggested fix to test that it is causing the problem is to disable reliableBinding like this:
<wsHttpBinding>
<binding name="reliableBinding">
<reliableSession ordered="true" enabled="false" />
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
If that works you might try re-enabling it then in SOAP-UI you can enable WS-ReliableMessaging following this article Using WS-Reliable messaging
Update:
For a little more info on what SOAP-UI might support albeit they're discussing an older version see WCF services testing with SOAP-UI
If all else fails, I'd suggest posting in their forum/community
Another answer(s) from SO that might help Problems with wcf reliable session reliable messaging
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" />
I've been trying to implement the exmaples provided in the question posted previously below:
Calling WCF service by VBScript
In my specific scenario I need to pass in a single string variable which will return an array of strings but having little luck.
I suspect I'm having a tough time getting the envelope request correct. Below is the wdsl that I'm trying to call. Can you give me an example of how i can call this passing in the parameter and parsing the return array?
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions name="TestSvc" targetNamespace="http://tempuri.org/" 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">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localHost/testSvc.svc?xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://localHost/testSvc.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://localHost/testSvc.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="ITestSvc_GetDataBy_Id_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataBy_Id" />
</wsdl:message>
<wsdl:message name="ITestSvc_GetDataBy_Id_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataBy_IdResponse" />
</wsdl:message>
<wsdl:portType name="ITestSvc">
<wsdl:operation name="GetDataBy_Id">
<wsdl:input wsaw:Action="http://tempuri.org/ITestSvc/GetDataBy_Id" message="tns:ITestSvc_GetDataBy_Id_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestSvc/GetDataBy_IdResponse" message="tns:ITestSvc_GetDataBy_Id_OutputMessage" />
</wsdl:operation>
<wsdl:binding name="BasicHttpBinding_TestSvc" type="tns:ITestSvc">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDataBy_Id">
<soap:operation soapAction="http://tempuri.org/ITestSvc/GetDataBy_Id" 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="TestSvc">
<wsdl:port name="BasicHttpBinding_ITestSvc" binding="tns:BasicHttpBinding_ITestSvc">
<soap:address location="http://localhost/TestSvc.svc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This WSDL document doesn't contain the schema (all the <wsdl:import> statements) for the input / output of the operations, so it's impossible to tell what the request should look like based on this information alone.
But one thing you can do: open WCFTestClient.exe, point it to the WSDL of the running service, then - while running a tool such as Fiddler - send a request to the service. This way you'll be able to see the request going on, and the service response. At that point, replicate the request (including things such as the HTTP header SOAPAction, if applicable), and the request body.
I'm trying to add to the generated wcf 4.0 web config some binding configurations for my service.
For some reason, after I publish the service to the IIS and logging to the service wsdl, I still see the old configurations (basicHttpBinding instead wsHttpBinding).
Here is my code:
Web.Config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<wsHttpBinding>
<binding name="PDFServiceBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="PDFService">
<endpoint address="http://localhost/PDFService/PDFService.svc"
binding="wsHttpBinding" bindingConfiguration="PDFServiceBinding"
contract="PDF.Service.IPDFService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/PDFService/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
PDFService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.IO;
namespace PDF.Service
{
public class PDFService : IPDFService
{
...
}
}
IPDFService.cs
namespace PDF.Service
{
[ServiceContract]
public interface IPDFService
{
...
}
}
The wsdl after the publish:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions name="PDFService" targetNamespace="http://tempuri.org/" 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">
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost/PDFService/PDFService.svc?xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://localhost/PDFService/PDFService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://localhost/PDFService/PDFService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/PDF" />
</xsd:schema>
</wsdl:types>
- <wsdl:message name="IPDFService_Save_InputMessage">
<wsdl:part name="parameters" element="tns:Save" />
</wsdl:message>
- <wsdl:message name="IPDFService_Save_OutputMessage">
<wsdl:part name="parameters" element="tns:SaveResponse" />
</wsdl:message>
- <wsdl:portType name="IPDFService">
- <wsdl:operation name="Save">
<wsdl:input wsaw:Action="http://tempuri.org/IPDFService/Save" message="tns:IPDFService_Save_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IPDFService/SaveResponse" message="tns:IPDFService_Save_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="BasicHttpBinding_IPDFService" type="tns:IPDFService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="Save">
<soap:operation soapAction="http://tempuri.org/IPDFService/Save" 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="PDFService">
- <wsdl:port name="BasicHttpBinding_IPDFService" binding="tns:BasicHttpBinding_IPDFService">
<soap:address location="http://localhost/PDFService/PDFService.svc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Your Service element should be as below:
<service name="PDF.Service.PDFService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="PDFServiceBinding" contract="PDF.Service.IPDFService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
NOTE: your are missing to provide namespace in your service name. The name of the service should be fully qualified.