问题
My device has a DPWS web service with a single output (wsdl:output) that I need to subscribe to with a Wcf client
The client is a regular .Net 4.0 application - not .net-micro-framework.
I need an example or tutorial or other resource relating to building such a client to such a service.
'Add Service Reference' produces non-working code, 'Add Web Reference' hangs.
The Wsdl is below.
If there's any further information required to answer this question please let me know.
Many thanks
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://schemas.xmlsoap.org/ws/2006/02/devprof"
xmlns:po="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:tns="http://www.test.fi/wsdl/THLGateway"
xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
name="THLGateway"
targetNamespace="http://www.test.fi/wsdl/THLGateway">
<po:Policy Id="EventingServicePolicy">
<p:profile />
<p:PushDelivery />
<p:DurationExpiration />
<p:ActionFilter />
</po:Policy>
<types>
<xsd:schema targetNamespace="http://www.test.fi/wsdl/THLGateway"
elementFormDefault="qualified">
<xsd:element name="thlChangeEvent">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="gatewayID"
type="xsd:string"
nillable ="true"
minOccurs="0"/>
<xsd:element name="nodeID"
type="xsd:string"
minOccurs="0"
nillable ="true"/>
<xsd:element name="temperature"
nillable ="true"
minOccurs="0"
type="xsd:double"/>
<xsd:element name="humidity"
nillable ="true"
minOccurs="0"
type="xsd:double"/>
<xsd:element name="light"
nillable ="true"
minOccurs="0"
type="xsd:double"/>
<xsd:element name="battery"
nillable ="true"
minOccurs="0"
type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<wsdl:message name="thlChangeResponse">
<wsdl:part name="parameters"
element="tns:thlChangeEvent"/>
</wsdl:message>
<wsdl:portType name="THLGatewayPortType"
wse:EventSource="true">
<wsdl:operation name="thlChange">
<wsdl:output message="tns:thlChangeResponse"/>
</wsdl:operation>
</wsdl:portType>
<binding name="THLGatewayPortType"
type="tns:THLGatewayPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<po:PolicyReference URI="#EventingServicePolicy"
wsdl:required="true" />
<wsdl:operation name="thlChange">
<soap:operation style="document"/>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</binding>
<service name="THLGateway">
<port name="THLGatewayPortType"
binding="tns:THLGatewayPortType">
<soap:address location="http://192.168.0.93:80/dpws/ws01"/>
</port>
</service>
</definitions>
回答1:
Single Output means that this service generates Events. You will want to look for WS-Eventing. It is not supported in stock .Net 4.0 WCF, but a project on CodeProject is implementing this functionality on top of WCF. Are you still interested in this topic?
来源:https://stackoverflow.com/questions/11358039/dpws-web-service-with-event-wcf-client-example-or-suggestions-sought