Jump to content

Consuming a .net web service with php code


klaibert26

Recommended Posts

Hi

 

i build a web service with .net

http://ofir0803.somee.com/Service1.asmx

 

and i am tryinn to call him with php

http://ofir0803.200u.com/britannia/client.php

 

but i keep getting a error:

 

wsdl error: HTTP ERROR: Couldn't open socket connection
to server http://www.ofir0803.somee.com/Service1.asmx?WSDL prior to connect().
This is often a problem looking up the host name.

 

this is the client.php code:

<?php
require_once("../nusoap/nusoap.php");




$client = new nusoap_client("http://www.ofir0803.somee.com/Service1.asmx?WSDL", "wsdl",”, ”, ”, ”);

$err = $client->getError();
if ($err) {
echo "<h2>Constructor error</h2><pre>" . $err . "</pre>";
}
$param = "";
$result = $client->call("functionName", $param, ”, ”, false, true);

if ($client->fault) {
echo "<h2>Fault</h2><pre>";
print_r($result);
echo "</pre>";
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo "<h2>Error</h2><pre>" . $err . "</pre>";
} else {
// Display the result
echo "<h2>Result</h2><pre>";
print_r($result);
echo "</pre>";
}
}
?>

 

For the past two days I try to solve this problem without any success.

Please help :confused:

Link to comment
Share on other sites

  • 3 weeks later...

Maybe you want to try this code.

 

<?php
require 'SOAP/Client.php';
$soapoptions = array('namespace' => 'http://tempuri.org/', 'trace' => 0);
$soapclient = new SOAP_Client( 'http://ofir0803.somee.com/Service1.asmx?WSDL');

//echo $soapclient->call('HelloWorld', array(), $soapoptions); //Alternative
echo $soapclient->HelloWorld( array() );
echo $soapclient->faultstring;
echo $soapclient->detail;

if (PEAR::isError($soapclient)){
    print("<br>An error #" . $soapclient->getCode() . " occurred!<br>");
    print(" Error: " . $soapclient->getMessage() . "<br>\n");
}
else{
    print("\n<br><pre>");
    print_r( $soapclient );
    print("</pre><br>\n");
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.