[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

PHP-SOAP Server was unable to process

hello there,

i am trying to get xml data from a web service.but i get this error.
Array ( [faultcode] => soap:Server [faultstring] => Server was unable to process request. --> The root element is missing. [detail] => )

the code i am running is below.please help me sort this.

<?php
require_once("lib/nusoap.php");
$parameters = array('CustomerID' => 2);

$soap = new soapclient1('http://.asmx?wsdl');
$soapAction = "http://tempuri.org/GetShoppingCart";
$result = $soap->send($paramaters,$soapAction);

print_r($result);
?>
0
zolf
Asked:
zolf
  • 4
  • 3
1 Solution
 
RobOwner (Aidellio)Commented:
don't want to state the obvious but it looks like there is a issue the xml of the soap request. are you able to post the request in xml?
0
 
zolfAuthor Commented:

i have'nt tried it.
this is the wsdl service i am trying to call.can you please tell me what is the namespace for the below service

POST /portal/_WebService/PolPortalWebService.asmx HTTP/1.1
Host:
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetShoppingCart"

<?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:Body>
    <GetShoppingCart xmlns="http://tempuri.org/">
      <CustomerID>int</CustomerID>
    </GetShoppingCart>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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:Body>
    <GetShoppingCartResponse xmlns="http://tempuri.org/">
      <GetShoppingCartResult>
        <xsd:schema>schema</xsd:schema>xml</GetShoppingCartResult>
    </GetShoppingCartResponse>
  </soap:Body>
</soap:Envelope>
0
 
RobOwner (Aidellio)Commented:
i think this would really help you:
http://dietrich.ganx4.com/nusoap/downloads/7469_Chap08.pdf

why have you done this:

new soapclient1 ?? not soapclient?

('http://.asmx?wsdl'); is this a real url or are you hiding it on purpose?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
zolfAuthor Commented:


hiding it.but if you want i can display it.
0
 
zolfAuthor Commented:

thanks mate for your help.on page 315 of that book you gave it talks about namespace.how do i get my namespace.please help.
0
 
RobOwner (Aidellio)Commented:
it looks like it's http://tempuri.org which is the default (see below)

http://msdn2.microsoft.com/en-us/library/aa719891(VS.71).aspx

On that page:
Applying the WebService Attribute

By applying the optional WebService attribute to a class implementing an XML Web service, you can set the default XML namespace for the XML Web service along with a string to describe the XML Web service.

It is highly recommended that this default namespace, which is http://tempuri.org, be changed before the XML Web service is made publicly consumable. This is important because the XML Web service must be distinguished from other XML Web services that might inadvertently use the namespace as the default (<http://tempuri.org/>).
0
 
RobOwner (Aidellio)Commented:
also: http://www.thescripts.com/forum/thread375900.html

they are saying you can use any namespace you want which i was under the same impression but then i'm not sure on the structure of your project.  i would guess its the domain you are hiding
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now