473,218 Members | 1,504 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,218 software developers and data experts.

Creation a simpliest web service

Hi all
I'm too newbie in web services so I can't figure out what the error I
made.
I have a SOAP server written in PHP:
<?php
// Define the method as a PHP function
function hello($name) {
return 'Hello, ' . $name;
}
// Pull in the NuSOAP code
//require_once('../../nusoap/lib/nusoap.php');
// Create the server instance
$server = new SoapServer('server.wsdl');
// Register the method to expose
$server->addFunction('hello');
// Use the request to (try to) invoke the service

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ?
$HTTP_RAW_POST_DATA : '';

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$server->handle();
}
else
{
$functions = $server->getFunctions();
foreach($functions as $func)
{
echo "$func<br>";
}
}
?>

The service is described by WSDL file:

<?xml version="1.0" encoding="utf-8"?>
<definitions name="HelloService"
targetNamespace="http://test-gentoo.home.local/HelloService.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://test-gentoo.home.local/HelloService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>

<portType name="Hello_PortType">
<operation name="hello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>

<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/
soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:examples:helloservice"/>
<input>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</input>
<output>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</output>
</operation>
</binding>

<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address location="http://192.168.0.102/web-services/soap/
server.php" />
</port>
</service>
</definitions>

Using wsdl.exe I have created a proxy class for this service. The
invocation of the service's method looks like this:

static void Main(string[] args)
{
Hello_Service client = new Hello_Service();
Console.WriteLine(client.hello("test"));
}

The request sent to the server looks like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/
encoding/"
xmlns:tns="http://test-gentoo.home.local/
HelloService.wsdl"
xmlns:types="http://test-gentoo.home.local/
HelloService.wsdl/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/">
<q1:hello xmlns:q1="urn:examples:helloservice">
<firstName xsi:type="xsd:string">test</firstName>
</q1:hello>
</soap:Body>
</soap:Envelope>

.... and response looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Bad Request</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I can't understand where mistake is. I checked the request according
to SOAP specification - seems like it's correct. Did I miss anything?

Thank you in advance.
Mykhaylo.

Jun 2 '07 #1
0 1579

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

Similar topics

0
by: Will Arrowsmith | last post by:
Hi All, I am aiming to create a multiframe Tiff file that I can fax using the windows fax service FAXCOMLib. I have created an array of Bitmaps (pages I want in my fax doc) and succesfully...
0
by: RJ | last post by:
I saw an article on MSDN knowledge base that explains how to use a SQLXML tool ( IIS Configuration ) to select a stored procedure and generate a web service wrapper. I noticed that the example to...
14
by: Bert Vandenberghe | last post by:
Hi, I was wondering if there are any best practices on the creation of webmethods? I'll try to explain this a little more: My problem is that we are changing an existing (large) DCOM application...
8
by: Ankit Aneja | last post by:
Hi I have made a windows service in C#.Net Now I want to create a setup of this service http://www.codeproject.com/dotnet/simplewindowsservice.asp I read this article Now my service is also using...
1
by: Enrico Foschi | last post by:
GoodMorning, I'm an italian developer, so, first of all, excuse me for my poor and incorrect english. I am writing here hoping to find some advice for a procedure that a like to create: I...
3
by: Limunski Magarac | last post by:
Hi all :) My apologies if I posted in the wrong groups, but I just jumped in MS SQL waters, so any guidance will be appreciated. What I'm trying to do is the following process: present...
1
by: mitrofun63 | last post by:
Hi, All I have trouble with db2 instance creation (DB2 9.1.2 on AIX 5.3) When i run command for instance creation : ../db2icrt -a SERVER -p 50000 -s ese -u db2fenc1 db2inst1 a reciveve...
2
by: =?Utf-8?B?am9obnByZW1p?= | last post by:
Hi there, I have a web app that adds user into w2k3 server and adds it to the administrator group. The code snippet is something like this: try { DirectoryEntry AD = new...
0
by: =?Utf-8?B?U2ViYXN0aWFuIEZyw6Ruaw==?= | last post by:
In several locations in the MSDN Mappoint Web Service SDK it says: "Creating Polygons There are several ways you can create and prepare polygon data for upload to the Customer Service Site: 1....
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: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
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
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
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
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...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.