?
Solved

Server did not recognize the value of HTTP Header SOAPAction

Posted on 2004-09-16
3
Medium Priority
?
19,726 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

801 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