Solved

Server did not recognize the value of HTTP Header SOAPAction

Posted on 2004-09-16
3
19,645 Views
Last Modified: 2008-01-09
I searched the web and experts-exchange for this problem and none of the solutions given seems to work in my case.
I am using a VB.NET Client with an ASP.NET Web Service.
The VB.NET client code to send the XML request is as follows........

        Dim xmlHTTP As MSXML2.XMLHTTP40 = New MSXML2.XMLHTTP40
        Dim xmlDoc As MSXML2.DOMDocument = New MSXML2.DOMDocument
        Dim url As String = "http://localhost/VoicesService/Service1.asmx"
        Dim strRequest As String
        Dim a As Integer = 2
        Dim b As Integer = 3

        strRequest = "<?xml version = '1.0' ?>" & _
        "<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:Body>" & _
        "<Add xmlns='http://tempuri.org/'>" & _
        "<a>" & a & "</a>" & _
        "<b>" & b & "</b>" & _
        "</Add></soap:Body></soap:Envelope>"
 
        xmlHTTP.open("POST", url, False)
        xmlHTTP.setRequestHeader("SOAPAction", "http://tempuri.org/Add")
        xmlHTTP.setRequestHeader("Content-Type", "text/xml; charset=UTF-8")
        xmlHTTP.setRequestHeader("Content-Length", "" & strRequest.Length)

        If xmlDoc.loadXML(strRequest) Then
            xmlHTTP.send(xmlDoc.xml)
            txtDisplay.AppendText(xmlHTTP.responseText)
            txtDisplay.AppendText(vbCrLf)
        Else
            txtDisplay.AppendText(xmlDoc.parseError.reason)
            txtDisplay.AppendText(xmlDoc.parseError.line)
        End If

        xmlHTTP = Nothing

...................................................................................
And the Web Service code is

Imports System.Data.Odbc
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Services.Description

<System.Web.Services.WebService(Namespace:="http://tempuri.org/VoicesService/Service1"), _
SoapDocumentService(SoapBindingUse.Literal, _
SoapParameterStyle.Wrapped, _
RoutingStyle:=SoapServiceRoutingStyle.SoapAction)> _
Public Class Service1

    Inherits System.Web.Services.WebService

    <WebMethod()> _
        Public Function Add(ByVal a As Integer, ByVal b As Integer)
        Return a + b
    End Function

End Class

Any sugesstions why the SOAPAction is not recongnized by the server.

Regards,
Cannibal Corpse
0
Comment
Question by:Cannibal_Corpse
3 Comments
 

Author Comment

by:Cannibal_Corpse
ID: 12076157
Nevermind, I solved the problem.

The line 7 of strRequest should say

"<Add xmlns='http://tempuri.org/VoicesService/Service1'>" & _

instead of just

"<Add xmlns='http://tempuri.org/'>" & _

The first one is the namespace full name.

Consequently, SOAPAction should be

http://tempuri.org/VoicesService/Service1/Add

instead of just

http://tempuri.org/Add

Regards,
Cannibal Corpse
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12327383
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now