【发布时间】:2009-12-18 21:27:33
【问题描述】:
我正在构建一个网络服务来接受来自公司的通知。该公司通知我该服务的结构不正确,并为我提供了一个工作 Web 服务的 .asmx。它看起来像这样:
请求:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<AuthenticationInfo
xmlns="http://www.usps.com/postalone/services/UserAuthenticationSchema">
<UserId xmlns="">string</UserId>
<UserPassword xmlns="">string</UserPassword>
</AuthenticationInfo>
<fullServiceAddressCorrectionNotification
xmlns="http://www.usps.com/postalone/services/POCustomerMailXMLServices">string</fullServiceAddressCorrectionNotification>
</soap12:Body>
</soap12:Envelope>
回复:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FullServiceNixieDetailNotificationResponse
xmlns="http://idealliance.org/maildat/Specs/md091/mailxml70C/mailxml">
<FullServiceNixieDetailNotificationResult>string</FullServiceNixieDetailNotificationResult>
</FullServiceNixieDetailNotificationResponse>
</soap12:Body>
</soap12:Envelope>
我的看起来像这样: 要求:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FullServiceNixieDetailNotification
xmlns="http://idealliance.org/maildat/Specs/md091/mailxml70C/mailxml">
<AuthenticationInfo>
<UserID>string</UserID>
<Password>string</Password>
</AuthenticationInfo>
<fullServiceAddressCorrectionNotification>string</fullServiceAddressCorrectionNotification>
</FullServiceNixieDetailNotification>
</soap12:Body>
</soap12:Envelope>
回复:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<notificationResponse
xmlns="http://www.usps.com/postalone/services/POCustomerMailXMLServices">string</notificationResponse>
</soap12:Body>
</soap12:Envelope>
如您所见,我的东西被包裹在一个额外的元素中,我需要摆脱它。不幸的是,我不知道该怎么做。我的网络服务代码如下:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Data.SqlClient
Public Structure AuthenticationInfoType
Dim UserID As String
Dim Password As String
End Structure
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://idealliance.org/maildat/Specs/md091/mailxml70C/mailxml")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class USPSMailXML
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function FullServiceNixieDetailNotification(ByVal AuthenticationInfo As AuthenticationInfoType, ByVal fullServiceAddressCorrectionNotification As String) As String
'Some code here
Return "MyResponse"
End Function
【问题讨论】:
标签: vb.net web-services asmx