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 8650475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:49:55+00:00 2026-06-12T13:49:55+00:00

I am trying to set up a SOAP service in php. I declared a

  • 0

I am trying to set up a SOAP service in php.
I declared a server php function and I am able to call that function with a SOAP type http request where the content is my SOAP envelope.

The XML content of the SOAP body is the argument of the function I assume, but I don’t know how to access the information in it in my php code.

I noticed that the function argument is an instance of stdClass by default, and I actually wonder why it is not casted on an XML or DOM object by php – it’s a SOAP call isn’t it?
But all right, now it’s up to me to get the information out of the object, which is not easy because there’s no methods assigned to stdClass, so it’ll have to be standard php functions.
So I tried serialize, but this gave me some rubbish, not the XML string I expected.

What to do?

EDIT

note that below has no example code of what I wish to do – get some detail data from the XML content of the SOAP request – because I don’t know how to code getting it from the stdClass object

On request of david, here’s some details.

php code:

<?php
    function mi102($arg) {
        $txt = serialize ($arg);
        $result = new SoapVar ($txt, XSD_ANYXML);
        return($result);
    }
    ini_set( "soap.wsdl_cache_enabled", "0");
    $server = new SoapServer ("test.wsdl");
    $server -> addFunction ("mi102");
    try {
        $server -> handle();
    }
    catch (Exception $e) {
        $server -> fault ('Client', $e -> getMessage());
    }
?php>

http request is constructed by an application that I use; the http header and the soap envelope + body are generated around the XML I feed it:

SOAP request body content:

<mi102 xmlns="http://pse">
  <cdhead cisprik="21"/>
  <instr>
    <insid>
      <bcdt>20120930</bcdt>
    </insid>
  </instr>
</mi102>

The WSDL used is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://pse/" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="PSE" targetNamespace="http://pse/">
    <types>
        <xs:schema>
            <xs:import namespace="http://pse/" schemaLocation="PSE.xsd"/>
        </xs:schema>
    </types>
    <message name="MI102Req">
        <part name="cdhead" type="tns:cdhead_T"/>
        <part name="instr" type="tns:instr_T"/>
    </message>
    <message name="Res">
        <part name="cdhead" type="tns:cdhead_T"/>
    </message>
    <portType name="MIPortType">
        <operation name="mi102">
            <input message="tns:MI102Req"/>
            <output message="tns:Res"/>
        </operation>
    </portType>
    <binding name="MIBinding" type="tns:MIPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="mi102">
            <soap:operation soapAction="http://testServerURL/test_soap.php#mi102"/>
            <input>
                <soap:body use="literal" namespace="http://pse/"/>
            </input>
            <output>
                <soap:body use="literal" namespace="http://pse/"/>
            </output>
        </operation>
    </binding>
    <service name="PSE">
        <port name="MIPortType" binding="tns:MIBinding">
            <soap:address location="http://testServerURL/test_soap.php"/>
        </port>
    </service>
</definitions>

And the resulting XML (again, extracted from the SOAP body by the application I use), is

SOAP response:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:mi102Response xmlns:ns1="http://pse/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">O:8:"stdClass":2:{s:7:"cisprik";i:21;s:7:"version";s:2:"13";}</ns1:mi102Response>

Not nice.

  • 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-12T13:49:56+00:00Added an answer on June 12, 2026 at 1:49 pm

    I eventually found the answer in other threads on SO, like get-recieved-xml-from-php-soap-server

    The solution is to use the following:

    $inp = file_get_contents ('php://input');
    

    Note: I could not find any function that can act on the stdClass input argument and can retrieve the XML SOAP Body contents from it.
    So the best option is to use the standard php input variable. Note that this has the following structure: Envelope/Body/..inputXML.., which is the exact http request content that is posted to the server.

    Note: http_get_request_body may work too, but my php server did not support this function. I think that file_get_contents is supported on every php server from some version onwards.

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

Sidebar

Related Questions

I'm currently trying to set up a SOAP-server using the following code. server.php <?php
I am trying to implement a web service that accepts SOAP 1.2 over HTTP
I have been trying to set up a PHP based SOAP client to connect
I'm trying to migrate a live, active WCF service (SOAP, standard HTTP binding config)
So I'm trying to write a php SOAP client that requires the user to
I'm trying to call a web service in an Excel Macro: Set objHTTP =
I'm trying to call a WCF Service from XCODE that has an Object as
I'm trying to implement a stateful web service in PHP using the SOAP extension.
I am trying to call an asmx service using jQuery Ajax. POST /YderWS.asmx HTTP/1.1
Im trying set the single table inheritance model type in a form. So i

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.