Hello Everbody,
I have to connect .Net Micro Framework application (on FEZ Cobra) to an existing web service hosted in WCF on a Windows Service / IIS.
So I have tested the HelloWorldServer_WCF and HelloWorldClient_MF source in the .net micro framework 4.1 to understand how works the DPWS and realize WCF communication.
The samples work well but when I have tried to connect HelloWorldClient_MF application to my own hosted WCF HelloWorldServer_WCF application on IIS, I have got the following error from the ServiceHelloWCFClientProxy.cs source section Send service request
public virtual HelloWCFResponse HelloWCF(HelloWCF req)
{
// Create request header
String action;
action = "http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCF";
WsWsaHeader header;
header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
WsMessage request = new WsMessage(header, req, WsPrefix.None);
// Create request serializer
HelloWCFDataContractSerializer reqDcs;
reqDcs = new HelloWCFDataContractSerializer("HelloWCF", "http://localhost/ServiceHelloWCF");
request.Serializer = reqDcs;
request.Method = "HelloWCF";
// Send service request
m_requestChannel.Open();
WsMessage response = m_requestChannel.Request(request); // Get the System.IO.IOException
m_requestChannel.Close();
// Process response
HelloWCFResponseDataContractSerializer respDcs;
respDcs = new HelloWCFResponseDataContractSerializer("HelloWCFResponse", "http://localhost/ServiceHelloWCF");
HelloWCFResponse resp;
resp = ((HelloWCFResponse)(respDcs.ReadObject(response.Reader)));
return resp;
}
#### Exception System.IO.IOException - 0x00000000 (3) ####
#### Message:
#### Ws.Services.Binding.HttpTransportBindingElement::OnProcessInputMessage [IP: 0059] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 0019] ####
#### Ws.Services.Binding.BindingElement::ProcessInputMessage [IP: 000f] ####
#### Ws.Services.Binding.RequestChannel::ReceiveMessage [IP: 002c] ####
#### Ws.Services.Binding.RequestChannel::Request [IP: 0017] ####
#### localhost.ServiceHelloWCF.ServiceHelloWCFClientProxy::HelloWCF [IP: 0047] ####
#### Microsoft.SPOT.Sample.TestApplication::Run [IP: 005a] ####
Une exception de première chance de type 'System.IO.IOException' s'est produite dans MFWsStack.dll
Une exception non gérée du type 'System.IO.IOException' s'est produite dans MFWsStack.dll
After spending time on it, I have noticed that the WSDL from the sample is bit different from the WSDL generate with MfSvcUtil tool. See the Bold lines on the post bottom .
Is there some doc from Microsoft providing guidance on how use WCF to communicate with DPWS devices?
Any ideas would be appreciated.
Thx in advace for your help.
Cedric
WSDL from HelloWorldServer_WCF Sample:
<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://localhost/ServiceHelloWCF" 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:i0="http://tempuri.org/"xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="ServiceHelloWCF"targetNamespace="http://localhost/ServiceHelloWCF">
<wsdl:import namespace="http://tempuri.org/" location="http://172.30.5.135:8084/319D0A4D-2253-47DC-AC4A-C1951FF6667D?wsdl=wsdl0"/>
<wsdl:types>
<xsd:schema targetNamespace="http://localhost/ServiceHelloWCF/Imports">
<xsd:import schemaLocation="http://172.30.5.135:8084/319D0A4D-2253-47DC-AC4A-C1951FF6667D?xsd=xsd0" namespace="http://localhost/ServiceHelloWCF"/>
<xsd:import schemaLocation="http://172.30.5.135:8084/319D0A4D-2253-47DC-AC4A-C1951FF6667D?xsd=xsd1"namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IServiceHelloWCF_HelloWCF_InputMessage">
<wsdl:part name="parameters" element="tns:HelloWCF"/>
</wsdl:message>
<wsdl:message name="IServiceHelloWCF_HelloWCF_OutputMessage">
<wsdl:part name="parameters" element="tns:HelloWCFResponse"/>
</wsdl:message>
<wsdl:portType name="IServiceHelloWCF">
<wsdl:operation name="HelloWCF">
<wsdl:input wsaw:Action="http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCF" message="tns:IServiceHelloWCF_HelloWCF_InputMessage"/>
<wsdl:output wsaw:Action="http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCFResponse" message="tns:IServiceHelloWCF_HelloWCF_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="ServiceHelloWCF">
<wsdl:port name="WSHttpBinding_IServiceHelloWCF" binding="i0:WSHttpBinding_IServiceHelloWCF">
<soap12:address location="http://172.30.5.135:8084/319D0A4D-2253-47DC-AC4A-C1951FF6667D"/>
<wsa10:EndpointReference>
<wsa10:Address>
http://172.30.5.135:8084/319D0A4D-2253-47DC-AC4A-C1951FF6667D
</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
WSDL from my own HelloWorldServer_WCF Sample:
<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://localhost/ServiceHelloWCF"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://tempuri.org/"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="ServiceHelloWCF"targetNamespace="http://localhost/ServiceHelloWCF">
<wsdl:import namespace="http://tempuri.org/" location="http://localhost:22082/ServiceHelloWCF.svc?wsdl=wsdl0"/>
<wsdl:types>
<xsd:schema targetNamespace="http://localhost/ServiceHelloWCF/Imports">
<xsd:import schemaLocation="http://localhost:22082/ServiceHelloWCF.svc?xsd=xsd0" namespace="http://localhost/ServiceHelloWCF"/>
<xsd:import schemaLocation="http://localhost:22082/ServiceHelloWCF.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IServiceHelloWCF_HelloWCF_InputMessage">
<wsdl:part name="parameters" element="tns:HelloWCF"/>
</wsdl:message>
<wsdl:message name="IServiceHelloWCF_HelloWCF_OutputMessage">
<wsdl:part name="parameters" element="tns:HelloWCFResponse"/>
</wsdl:message>
<wsdl:portType name="IServiceHelloWCF">
<wsdl:operation name="HelloWCF">
<wsdl:input wsaw:Action="http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCF" message="tns:IServiceHelloWCF_HelloWCF_InputMessage"/>
<wsdl:output wsaw:Action="http://localhost/ServiceHelloWCF/IServiceHelloWCF/HelloWCFResponse" message="tns:IServiceHelloWCF_HelloWCF_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="ServiceHelloWCF">
<wsdl:port name="BasicHttpBinding_IServiceHelloWCF" binding="i0:BasicHttpBinding_IServiceHelloWCF">
<soap:address location="http://localhost:22082/ServiceHelloWCF.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>