ASMX作为WCF服务消费,方法的附加参数是HEADER,HEADER应该传递什么
我在vs 2008中使用了ASMX服务。此时,调用方法如下所示:ASMX作为WCF服务消费,方法的附加参数是HEADER,HEADER应该传递什么,wcf,web-services,asmx,webservice-client,Wcf,Web Services,Asmx,Webservice Client,我在vs 2008中使用了ASMX服务。此时,调用方法如下所示: PostTravelData(TravelTransaction) //NOTE: property - "TOKENID" was set before calling to this method. PostTravelData(Header,TravelTransaction OUT TravelTransactionResponse) 现在,我在VS2012中使用了相同的ASMX服务
PostTravelData(TravelTransaction)
//NOTE: property - "TOKENID" was set before calling to this method.
PostTravelData(Header,TravelTransaction OUT TravelTransactionResponse)
现在,我在VS2012中使用了相同的ASMX服务,并将其添加为服务引用,因此,它将作为WCF服务使用
现在,in方法签名有一个额外的argumnet,名为-HEADER。因此,签名如下所示:
PostTravelData(TravelTransaction)
//NOTE: property - "TOKENID" was set before calling to this method.
PostTravelData(Header,TravelTransaction OUT TravelTransactionResponse)
请建议我应该通过什么作为标题。我不清楚我应该传递什么作为标题参数。
我尝试将direclty 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。这就是信息。