Solved

Server did not recognize the value of HTTP Header SOAPAction

Posted on 2004-09-16
3
19,681 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

736 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