Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:25:40+00:00 2026-06-03T17:25:40+00:00

I’m trying to create proper wsdl based soap request but with no success, here

  • 0

I’m trying to create proper wsdl based soap request but with no success, here is example of what I need:
soap.xml:

<?xml version="1.0" encoding="utf-8"?>
<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:Header>
      <AuthMember xmlns="http://tempuri.org/">
           <somefield>string</somefield>
      </AuthMember>
  </soap:Header>
  <soap:Body>
      <AuthenticateMember xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

My result is:
soap.xml:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"             xmlns:ns1="http://tempuri.org/" xmlns:ns2="http://schemas.xmlsoap.org/ws/2002/07/utility">
<SOAP-ENV:Header>
    <ns2:AuthMember>
        <somefield>somefieldvalue</somefield>
    </ns2:AuthMember>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
    <ns1:AuthenticateMember/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

this is my php code:



    class SoapHeaderAuthMember
    {

        public $somefield;

        public function __construct($somefield)
        {

            $this->somefield = $somefield;        

        }
    }

    $client = new SoapClient( 'https://www.somepage.com/service.asmx?WSDL', 
        array("exceptions"=>0, "trace" => 1 )
    );
    $authMember = new SoapHeaderAuthMember('somefieldvalue');


    $soapHeaders[] = new SoapHeader('http://schemas.xmlsoap.org/ws/2002/07/utility', 'AuthMember', $authMember);
    $client->__setSoapHeaders($soapHeaders);                 

    $client->__soapCall('AuthenticateMember',array());


see,

1.it generates SOAP-ENV:Envelope instead of SOAP-ENV:Envelope

2.in header: I have ns2:AuthMember instead of AuthMember

3.in body I have ns1:AuthenticateMember instead of AuthenticateMember xmlns=”http://tempuri.org/&#8221;

How can I get proper xml ? I’ve looked through php functions manuals and cannot find the answer, googling did not give me success results for my case.

Could you please help ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:25:41+00:00Added an answer on June 3, 2026 at 5:25 pm

    The result that has been generated is what has been requested in the code, but an explanation of some attributes of namespaces is in order:

    Each of the tags in an XML document has a fully-qualified form which is defined by the namespace and the tag name (even if it is in the ‘default’ namespace with no explicit namespace declaration). The fully-qualified version is typically written as {namespace}tag. By resolving the fully-qualified name it is possible to determine whether the representation of two elements is the same.

    Namespaces are associated with elements in multiple ways including explicit namespace inclusion with the element

    Example:
    <AuthMember xmlns="http://tempuri.org/">
    resolving to fully-qualified name {http://tempuri.org/}AuthMember
    

    and via namespace-associated prefix

    Example:
    <... xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
    resolving to {http://schemas.xmlsoap.org/soap/envelope/}Header
    

    The prefix is in scope for the element in which the prefix was declared and any contained elements. The actual prefix used is not important (soap, SOAP-ENV or randomprefix could be used for the http://schemas.xmlsoap.org/soap/envelope/ namespace), although good practice is to use something meaningful.

    Given that, the fully-qualified elements in the ‘desired’ and ‘actual’ documents are almost the same, the anomaly being the header element AuthMember. In your desired you indicate a namespace of http://tempuri.org/ for a fully-qualified {http://tempuri.org/}AuthMember. In the actual the prefix association results in a fully-qualified {http://schemas.xmlsoap.org/ws/2002/07/utility}AuthMember.

    This is the result of the SoapHeader instantiation specifying the …utility namespace for AuthMember. Changing that statement in your code to use the http://tempuri.org/ namespace should result in the actual document matching the desired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
In my XML file chapters tag has more chapter tag.i need to display chapters
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.