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:

Hi There

 

I have also been having a problem trying to do exactly what you are doing. My problem is not that I cannot connect, but in passing the params, so my connection code is working. Check out my code, it might help you

 

http://www.phpfreaks.com/forums/index.php/topic,267646.0.html

  • 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");
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.