Aleksandar's computer workshop
Let's see what Aleksandar was fixing today.
My findings, tips & tricks related to computers, internet, programming and other stuff I was working with.

Solving problems with the MS header "SOAPAction"

June 8, 2009 23:45 by Aleksandar

Today I have faced some errors during implementation of some 3rd party SOAP service. Proxy was made with received WSDL file using this command:

"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl.exe" /language:VB  /protocol:SOAP /namespace:testNamespace sampleservice.wsdl /server

Command above will convert WSDL file to ASMX server proxy class file.

After first test I got this error:

The methods testMethod1 and testMethod2 use the same SOAPAction ''. When the RoutingStyle of the XML Web service is SoapAction, SOAPAction values must be unique across methods on the XML Web service. You can change the SOAPAction with the Action parameter to the SoapDocumentMethod or SoapRpcMethod attributes, or you can specify a RoutingStyle of RequestElement on the XML Web service.

In order to fix this problem add line marked with bold green color in class definition:

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42"), _
System.Web.Services.Protocols.SoapDocumentService(RoutingStyle:=SoapServiceRoutingStyle.RequestElement), _
System.Web.Services.WebServiceAttribute([Namespace]:="testNamespace"), _
System.Web.Services.WebServiceBindingAttribute(Name:="TestSoapBinding", [Namespace]:="testNamespace")> _
Public Class testWebService

' your class code comes here 

End Class