Solved

Server did not recognize the value of HTTP Header SOAPAction

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

23 Experts available now in Live!

Get 1:1 Help Now