I'm building a web service to accept notifications from a company. The company informed me that the service is incorrectly structured and provided me the .asmx of a working web service. It looks like this:
Request:
<?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>
Response:
<?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>
Mine looks like this: Request:
<?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>
Response:
<?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>
As you can see, my stuff is wraped in an extra element I need to get rid of. Unfortunatley, I'm not sure how to do this. My web service code is as follows:
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