.Net user can not connect to php Webservice -
i have php webservice code :
require_once('nusoap.php'); require_once('gw.interface.php'); $namespace = 'www.mydomain.com'; $server = new soap_server(); $server->soap_defencoding = 'utf-8'; $server->decode_utf8 = false; $server->encode_utf8 = true; $server->configurewsdl('smsserver', 'urn:smsserver'); $server->wsdl->addcomplextype( 'listarray', 'complextype', 'array', '', 'soap-enc:array', array(), array( array('ref'=>'soap-enc:arraytype','wsdl:arraytype'=>'xsd:string[]') ), 'xsd:string' ); /** * sendsms **/ $server->register('sendsms', array( 'fromnum' => 'xsd:string', 'tonum' => 'xsd:string', 'messagecontent' => 'xsd:string', 'messagetype' => 'xsd:string', 'user' => 'xsd:string', 'pass' => 'xsd:string' ), array('return' => 'xsd:string'), $namespace, 'sendsms', 'rpc', 'encoded', 'send sms'); function sendsms($fromnum, $tonum, $messagecontent, $messagetype, $user, $pass) { return gwi::sendsms($fromnum, $tonum, $messagecontent, $messagetype, $user, $pass); } /** * getcredit **/ $server->register('getcredit', array( 'user' => 'xsd:string', 'pass' => 'xsd:string' ), array('return' => 'xsd:string'), $namespace, 'getcredit', 'rpc', 'encoded', 'check credit'); function getcredit($user, $pass) { return gwi::getcredit($user, $pass); } /** * getstatus **/ $server->register('getstatus', array( 'user' => 'xsd:string', 'pass' => 'xsd:string', 'batchid' => 'xsd:string', 'unique_ids' => 'tns:listarray' ), array('return' => 'xsd:string'), $namespace, 'getstatus', 'rpc', 'encoded', 'get messages delivery status'); function getstatus($user, $pass, $batchid, $uniqs) { return gwi::getstatus($user, $pass, $batchid, $uniqs); } $server->service($http_raw_post_data);
the problem code worked before change webserver apache nginx.
i used code on server , ok. same code same request.
so when .net client wants connect webservice can detect webservice. when wants call of 1 of methods error in .net :
{"the remote server returned error: (404) not found."}
and client code example in vb
private sub form1_load(sender object, e eventargs) handles mybase.load dim x servicereference2. smsserverporttypeclient = new servicereference2.smsserverporttypeclient() dim result string = "-" result = x.getcredit("test", "123456") + " "; msgbox(result) end sub
have tried adding ws web reference on .net project, instead of service reference? far know, php webservice has treated web service instead of common one, asmx does.
to so, follow these simple steps:
- right click on project in solution explorer.
- click on "add service reference"
- click "advanced" button on bottom-left of dialog window (i'm sorry if button has name, i'm translating these steps spanish gui)
- go again bottom-left corner , click "add web reference" button.
- add webservice url on field on top, give name in field right, , voilá!
the process, then, should more simple: use methods of ws using name gave service namespace.
i hope suits you. luck!
Comments
Post a Comment