473,226 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

PHP 5 soap request with XML-string param.

Question.

I have a wsdl soap request structure as follows:

<soap:Envelope xmlns:xsi="..." xmlns:xsd="..." xmlns:soap="...">
<soap:Header>... </soap:Header>
<soap:Body>
<SaveItem xmlns="...">
<ItemXml>xml</ItemXml>
<PropertyView>string</PropertyView>
</SaveItem>
</soap:Body>
</soap:Envelope>

I cant seem to work out how to add an string representation of an xml
document as the ItemXml parameter.
Currently I use the __soapCall() function with an assoc array as the
second argument as shown below:

$params = array("ItemXml" => $itemxml, "PropertyView" =>
$propertyview);
$result = $this->soapclient->__soapCall($function,
array("parameters"=>$params), null, $this->soapheaders);

There is a valid XML string as the ItemXML param, however, using the
__getLastResponse() function I get an empty XML string as the ItemXML
param. eg.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." xmlns:ns1="...">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:SaveItem>
<ns1:ItemXml />
<ns1:PropertyView>website<ns1:PropertyView>
</ns1:SaveItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Thankyou in advance for any response

Ryan.

Sep 19 '05 #1
1 13785
If you want to pass an xml document node as a function parameter, your
need to create a SoapVar object with a text represention of the xml
node and the XSD_ANYXML encoding constant. However, this constant is
not exported by the extension and is not documented for some unknown
reason.

Therefore, to get this to work you must either register the XSD_ANYXML
#define as a PHP constant, or use the integer value of the constant
when creating the SoapVar, which is 147.

$soapvar = new SoapVar($xml_text, 147);

$params = array("ItemXml" => $soapvar, "PropertyView" => "blah");
$result = $this->soapclient->__soapCall("SaveItem",
array("parameters"=>$params), null, $this->soapheaders);

However, this still doesnt give the correct result. For some reason,
the ItemXml parameter node is not wrapped around the associated xml
parameter in the soap request, and the following soap is produced
(assumming '<item>blah</item>' is used as the $xml_text):

<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." xmlns:ns1="...">
<SOAP-ENV:Header>...</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:SaveItem>
<item>blah</item>
<ns1:PropertyView>blah</ns1:PropertyView>
</ns1:SaveItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Sep 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Gaulin | last post by:
Hello I am currently trying to write WSDL files for some Web Services we already have. The web services were written by someone else and they take and produce soap/xml message. Is there a...
0
by: ramas | last post by:
Hi, I am new to PHP scripting and i am trying to connect to a soap server (as mentioned below) using the SOAP extension comesup with PHP. Now my requirement is to add my HTTP header fields along...
5
by: mark kurten | last post by:
i have a requirement to send a soap message to a web service. i'm familiar with the soap toolkit using vb. i need to generate a xml document which i think i can do, but i don't know how to...
0
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method...
1
by: Ron Eggler | last post by:
> Hi, > > I'm supposed to send following request as a html-request(from a html-link) > is it possible? how do i do that? do i use the '<a href'-tag as well? > Thank you! > > > <xs:request...
3
by: Siva | last post by:
Hi all, I want to Convert a WSDL to a SOAP message. Is there any way to do this. I am using .NET 2.0 Thanks in Advance Siva
0
by: elgemcdlf | last post by:
I have a small db built with Lotus Approach that polls servers and catalogs the responses. I have now run into one that uses a Web Service for the data I desire. Below is the WSDL file along with the...
3
by: Joshua Beall | last post by:
Hi All, I've got the following PHP code: $service = new SoapClient("http://www.webservicex.net/length.asmx? wsdl"); $result = $service->ChangeLengthUnit(10,"Inches","Centimeters");...
2
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until I...
1
by: moorcroft | last post by:
I'm sending the following SOAP request to a webservice (I've had to star out some parts of it for privacy purposes): <?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.