怎样使用这个WSDL文件?(急求答案

qsc_bmn 2010-03-18 11:17:46
我现在有了一个WSDL文件WMLP.WSDL,我按照这个网页http://www.newasp.net/tech/net/11374.html上的步骤在解决方案中添加了它的web引用,其中应该是包括WMLP_GetBaseMsg ( ) 、WMLP_GetCap ( ) 、WMLP_GetVersion ( ) 、WMLP_Subscribe ( ) 四个方法。我想知道我要不要自己完成这些方法的实现代码,如果需要的话在哪里写?

我在代码中是这样引用其中的方法的,不知道对不对?
WITSML_Publish.WMLP a = new WITSML_Publish.WMLP{};
a.WMLP_GetBaseMsg(……);
a.WMLP_GetCap(……);
a.WMLP_GetVersion(……);
a.WMLP_Subscribe(……);

网上说的使用wsdl的方法和上面那个链接中说的方法顺序一般都是反的:先创建web服务项目、编写代码再生成动态库。我想知道有了wsdl后,怎样完成对应的web service方法,自己编写么?

另外帮忙推荐本适合新手看的web service教程,.net实现的,最好讲的全面一些。

WMLP.WSDL中内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="WMLP" targetNamespace="http://www.witsml.org/wsdl/120" xmlns:wsdlns="http://www.witsml.org/wsdl/120" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
<documentation>WITSML Version 1.2.0 PUBLISH interface WSDL file
</documentation>
<!-- Abstract Definitions Section - <types>, <message> and <portType> elements -->
<!-- <types> element declares user-defined machine and language independent data types, and is not needed for the WITSML PUBLISH interface, which uses only W3C-defined data types -->
<!-- <message> elements define request/response messages and their parameters-->
<message name="Publish.WMLP_GetBaseMsg">
<part name="ReturnValueIn" type="xsd:short"/>
</message>
<message name="Publish.WMLP_GetBaseMsgResponse">
<part name="Result" type="xsd:string"/>
</message>
<message name="Publish.WMLP_GetCap">
<part name="OptionsIn" type="xsd:string"/>
</message>
<message name="Publish.WMLP_GetCapResponse">
<part name="CapabilitiesOut" type="xsd:string"/>
<part name="SuppMsgOut" type="xsd:string"/>
<part name="Result" type="xsd:short"/>
</message>
<message name="Publish.WMLP_GetVersion">
</message>
<message name="Publish.WMLP_GetVersionResponse">
<part name="Result" type="xsd:string"/>
</message>
<message name="Publish.WMLP_Subscribe">
<part name="SubscriptionIn" type="xsd:string"/>
<part name="OptionsIn" type="xsd:string"/>
<part name="CapabilitiesIn" type="xsd:string"/>
</message>
<message name="Publish.WMLP_SubscribeResponse">
<part name="Result" type="xsd:short"/>
<part name="SubscriptionOut" type="xsd:string"/>
<part name="SuppMsgOut" type="xsd:string"/>
</message>
<!-- <portType> element groups the functions (operations) into an interface -->
<portType name="PublishSoapPort">
<!-- <operation> elements define the function signatures (operation name and parameters) and associate the input and output messages -->
<!-- parameterOrder attribute values must be separated by a single space -->
<operation name="WMLP_GetBaseMsg" parameterOrder="ReturnValueIn">
<input message="wsdlns:Publish.WMLP_GetBaseMsg"/>
<output message="wsdlns:Publish.WMLP_GetBaseMsgResponse"/>
</operation>
<operation name="WMLP_GetCap" parameterOrder="OptionsIn CapabilitiesOut SuppMsgOut">
<input message="wsdlns:Publish.WMLP_GetCap"/>
<output message="wsdlns:Publish.WMLP_GetCapResponse"/>
</operation>
<operation name="WMLP_GetVersion" >
<input message="wsdlns:Publish.WMLP_GetVersion"/>
<output message="wsdlns:Publish.WMLP_GetVersionResponse"/>
</operation>
<operation name="WMLP_Subscribe" parameterOrder="SubscriptionIn OptionsIn CapabilitiesIn SubscriptionOut SuppMsgOut">
<input message="wsdlns:Publish.WMLP_Subscribe"/>
<output message="wsdlns:Publish.WMLP_SubscribeResponse"/>
</operation>
</portType>
<!-- Concrete Definitions Section - <binding> and <service> elements -->
<!-- <binding> specifies the protocol binding for each operation in the <portType> section -->
<binding name="PublishSoapBinding" type="wsdlns:PublishSoapPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="WMLP_GetBaseMsg">
<soap:operation soapAction="http://www.witsml.org/action/120/Publish.WMLP_GetBaseMsg"/>
<input>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="WMLP_GetCap">
<soap:operation soapAction="http://www.witsml.org/action/120/Publish.WMLP_GetCap"/>
<input>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="WMLP_GetVersion">
<soap:operation soapAction="http://www.witsml.org/action/120/Publish.WMLP_GetVersion"/>
<input>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="WMLP_Subscribe">
<soap:operation soapAction="http://www.witsml.org/action/120/Publish.WMLP_Subscribe"/>
<input>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.witsml.org/message/120" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<!-- <service> specifies the portType for each binding and the URL of the service -->
<service name="WMLP">
<port name="PublishSoapPort" binding="wsdlns:PublishSoapBinding">
<soap:address location="http://yourorg.com/yourwebservice"/>
</port>
</service>
</definitions>

...全文
620 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
w210601030 2010-03-31
  • 打赏
  • 举报
回复
学习中。。。
qsc_bmn 2010-03-22
  • 打赏
  • 举报
回复
实现了?在哪实现了?我试着调用了一下里面的函数结果出现webexception:请求失败,响应为空。
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
因为我实在是个彻底的菜鸟啊,始终没找到一本专门介绍怎么部署web service的教材,零碎的知识都是从网上东边一点西边一点看来的,所以好多东西都不懂。就拿这个wsdl文件来说,我知道它是是服务端对外提供服务的描述。但是,它是我在实现web service方法的时候使用,还是我在客户端调用web服务的时候使用呢?
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
定义我知道,我想知道的是是实际怎么用?
MarcuseXiao 2010-03-19
  • 打赏
  • 举报
回复
WSDL仅仅是服务端对外提供服务的描述。
我这个措词可能不准确,但是是这么个意思。
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
我就是不清楚这个wsdl到底是在服务端实现web服务时使用,还是在客户端发现和调用web服务使用?
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
回楼上的,还没有实现,我就是不知道先有了wsdl再实现web service端的方法,网上说的一般都是先实现web service方法,再生成wsdl,郁闷
宝_爸 2010-03-19
  • 打赏
  • 举报
回复
如果没有看下这个:
http://www.codeproject.com/KB/webservices/myservice.aspx
宝_爸 2010-03-19
  • 打赏
  • 举报
回复
你web service端,实现了没?
宝_爸 2010-03-19
  • 打赏
  • 举报
回复
不用你自己实现,net framework会调用web service.
调用哪个webservice呢?
这个是用过web.config或者app.config配置。
检查这两个文件,是不是有类似下面的配置:

<DNCInterfaceClientSiteSample.Properties.Settings>
<setting name="DNCInterfaceClientSiteSample_DNCInterfaceServerDMZ_DNCInterfaceService"
serializeAs="String">
<value>https://pgo_sw_tester/PESCrmServices/HostNet11/DNCInterfaceServiceDMZNet11/DNCInterfaceServiceDMZNet11.svc</value>
</setting>
</DNCInterfaceClientSiteSample.Properties.Settings>


这个就是要调用的web service的地址。
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
那位好心人回答一下啊,真的好困惑
liss_2009 2010-03-19
  • 打赏
  • 举报
回复
学习中
gu7891 2010-03-19
  • 打赏
  • 举报
回复
webservice的方法已经实现了啊
wsdl只是描述了webservice中的方法接口而已
你需要调用它就是了
引用方式也和你那样差不多了
不过版本的差异,会有所不同
qsc_bmn 2010-03-19
  • 打赏
  • 举报
回复
可能我没说清楚,现在情况是这样,我被要求使用web service传输一种数据,这种数据时XML格式的,拥有一套完整的XSD文件。另外制定这套数据标准的集团也提供了2个WSDL文件,是关于怎样传输、存储、发布这种数据的接口的说明,其中一个就是我贴出来的。
我现在的问题是,我怎样编写web service的方法?如果直接向“hello world”例子里面那样,把hello world()函数改一下应该是不行的吧?具体步骤应该怎么做?谁能回答我?

12,165

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧