【发布时间】:2014-02-10 07:44:10
【问题描述】:
我在vs 2008中使用过ASMX服务,当时调用方法如下:
PostTravelData(TravelTransaction)
//NOTE: property - "TOKENID" was set before calling to this method.
现在,我在 VS2012 中使用了相同的 ASMX 服务并添加为服务引用,所以它作为 WCF 服务使用。
现在,在方法签名中有一个额外的 argumnet,称为 - “HEADER”。所以签名如下:
PostTravelData(Header,TravelTransaction OUT TravelTransactionResponse)
请建议我应该将什么作为标题传递。我不清楚我应该通过什么作为 HEADER 参数。 我尝试通过将直接 TOKENID 值作为标头传递,但仍然无法正常工作。 我是否必须创建“RequestHeader”类型的对象并将 argumnet 保留为“TokenID”,然后传递给该方法的 argumnet?
下面是 SOAP wsdl:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<RequestHeader xmlns="http://www.example.com/Soa/Foundation/">
<Headers>
<anyType />
<anyType />
</Headers>
</RequestHeader>
</soap:Header>
<soap:Body>
<TravelTransaction xmlns="http://www.example.com/Soa/Foundation/">
<TravelTransactionRequest xmlns="http://www.example.com/Soa/Foundation/MessageDefinition.xsd">
<TravelData>
<TravelMsg>
<IsExcused>boolean</IsExcused>
<ScheduledMeetingId>int</ScheduledMeetingId>
<Comment>string</Comment>
<PostAttForScheduledPeriods>boolean</PostAttForScheduledPeriods>
</TravelMsg>
<TravelMsg>
<IsExcused>boolean</IsExcused>
<ScheduledMeetingId>int</ScheduledMeetingId>
<Comment>string</Comment>
<PostAttForScheduledPeriods>boolean</PostAttForScheduledPeriods>
</TravelMsg>
</TravelData>
</TravelTransactionRequest>
</TravelTransaction>
</soap:Body>
</soap:Envelope>
【问题讨论】:
-
这不是 WSDL。这只是信息。
标签: wcf web-services asmx webservice-client