• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 651
  • 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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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