Solved

Server did not recognize the value of HTTP Header SOAPAction

Posted on 2004-09-16
3
19,676 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

763 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