Webservices SOAP and Namespace prefixes

Discussion in 'ASP .Net' started by =?Utf-8?B?Q29ybmUgUmFiZQ==?=, Oct 26, 2004.

  1. Hi all

    I've got a webservices that will be called by a delphi product. They have
    defined a soap message that they will use to call my webservice. A header
    snippet is found below:
    <soap:Header>
    <mm:TheHeader xmlns:mm="http://The URL">
    <SomeValue>123</SomeValue>
    <AnotherValue>blabla</AnotherValue>
    </mm:TheHeader >
    </soap:Header>
    I've defined a Class that inherits from SoapHeader, and added the SoapHeader
    attribute to my webmethod, and included a public member of that type in my
    webservice class.
    No matter what I do, I can not get the header variable populated. I've even
    used SoapUnknownHeader in my webmethod, but to no joy.
    I've got a idea that it's got to do with the namespace prefix (mm) they are
    using. I included the namespace specified in the header, but still no luck.
    They are following the soap standard, and other companies are using their
    product, so there is no option of changing the soap enevelope.
    Is there any way that I can get the soapheader variable populated?

    Thanks in advance
     
    =?Utf-8?B?Q29ybmUgUmFiZQ==?=, Oct 26, 2004
    #1
    1. Advertising

  2. I am not sure what you were looking for.
    <%@ WebService language="C#" class="SoapHeaderTest" %>
    using System;
    using System.Xml;
    using System.Xml.Serialization;
    using System.Web.Services;
    using System.Web.Services.Protocols;

    [WebService(Namespace="urn:my-header-test")]
    public class SoapHeaderTest
    {
    public MyHeader myHeader;

    public SoapHeaderTest()
    {
    myHeader.myString = "Hello, there";
    }

    [SoapHeader ("myHeader",Direction=SoapHeaderDirection.InOut)]
    [WebMethod]
    public void MyMethod()
    {
    myHeader.myString = "Hello, from myMethod";
    return;
    }

    [XmlRoot(Namespace="urn:my-header")]
    public class MyHeader:SoapHeader
    {
    public string myString;
    }
    }


    Here is something that seems to work for me. This sets the namespace info
    correctly.


    --
    Girish Bharadwaj
    http://msmvps.com/gbvb
    "Corne Rabe" <> wrote in message
    news:...
    > Hi all
    >
    > I've got a webservices that will be called by a delphi product. They have
    > defined a soap message that they will use to call my webservice. A header
    > snippet is found below:
    > <soap:Header>
    > <mm:TheHeader xmlns:mm="http://The URL">
    > <SomeValue>123</SomeValue>
    > <AnotherValue>blabla</AnotherValue>
    > </mm:TheHeader >
    > </soap:Header>
    > I've defined a Class that inherits from SoapHeader, and added the
    > SoapHeader
    > attribute to my webmethod, and included a public member of that type in my
    > webservice class.
    > No matter what I do, I can not get the header variable populated. I've
    > even
    > used SoapUnknownHeader in my webmethod, but to no joy.
    > I've got a idea that it's got to do with the namespace prefix (mm) they
    > are
    > using. I included the namespace specified in the header, but still no
    > luck.
    > They are following the soap standard, and other companies are using their
    > product, so there is no option of changing the soap enevelope.
    > Is there any way that I can get the soapheader variable populated?
    >
    > Thanks in advance
    >
     
    Girish bharadwaj, Oct 26, 2004
    #2
    1. Advertising

  3. Thanks for the quick reply Girish

    I've got exactly the same code structure than what you recommended, but this
    still does not solve my problem. If you look at the soap header in my initial
    post, you will see the addition of a namespace prefix (mm) in the soap
    header. This is what's causing the problem, because everything works fine if
    I remove the namespace prefix, and use a normal default namespace declaration.
     
    =?Utf-8?B?Q29ybmUgUmFiZQ==?=, Oct 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S ML
    Replies:
    0
    Views:
    426
  2. Hubidubi
    Replies:
    1
    Views:
    510
    George Bina
    May 25, 2006
  3. Chris Spencer

    ElementTree Namespace Prefixes

    Chris Spencer, Jun 12, 2005, in forum: Python
    Replies:
    9
    Views:
    1,427
  4. Replies:
    0
    Views:
    1,122
  5. Cameron McCormack
    Replies:
    3
    Views:
    14,965
    Cameron McCormack
    Jul 3, 2007
Loading...

Share This Page