Please help to see the webservice of PHP calling C #

Source: Internet
Author: User
Tags apm oracleconnection stack trace wsdl
Header ("Content-type:text/html;charset=utf-8"); $client = new SoapClient ("http://s.dailiangu.com:8011/ Weblocaldata.asmx? WSDL "); $p = $client->__soapcall (' Return_package ', Array (' UN ' = ' xxxxxxx ', ' PS ' = ' xxxxxxx ', ' TopCount ' =>5 );//var_dump ($p);//results from this analysis

There is a method called Retrun_package, to pass three parameters, respectively, is the user name, password and the number of calls, here I use XXX instead, but finally error, I am not very familiar with PHP, I hope you correct.


Reply to discussion (solution)

UN PS two parameters changed to normal and valid try

I am using normal time to prompt the following error:
Fatal error:uncaught SoapFault exception: [Soap:server] System.Web.Services.Protocols.SoapException:Server was unable To process request. ---> System.NullReferenceException:Object reference not set to a instance of an Object. At WebService1.WebLocalData.Return_Package (string UN, String PS, Int32 TopCount) in f:\ development related \ website \ Test Service-external testing \ Service to leveling hall \ Webservice1\webservice1\weblocaldata.asmx.cs:line---End of inner exception stack trace---in E:\APM\APMSERV5.2.6\WW W\htdocs\templets\new\test.php:11 Stack Trace: #0 E:\APM\APMServ5.2.6\www\htdocs\templets\new\test.php (11): Soapclient->__soapcall (' Return_package ', Array) #1 {main} thrown in E:\APM\APMServ5.2.6\www\htdocs\templets\new\ test.php on line 11

PHP soapclient package is not good, too transparent, false hints pit dad, but this example I think you have to change to this

$client = new SoapClient ("Http://s.dailiangu.com:8011/WebLocalData.asmx? WSDL "); $p = $client->return_package (' UN ' = ' xxxxxxx ', ' PS ' = ' xxxxxxx ', ' topcount ' = ' 5 '));


Not yet, just curl up or fsockopen follow
Http://s.dailiangu.com:8011/WebLocalData.asmx?op=Return_Package
The Request protocol format request was given in the past.

It's ready, thank you so much. I understand. So how to get the parameters inside, if the return has an ID this parameter, how to get it?

The dataset type is returned, with each row (1 packages per 1 lines) containing the following 5 values:

[WorkID] Studio number, e.g. 48
[PID] Package number, for example: 512
[Ptitle] Package name, for example: XXXXXXXX
[Pri] Price, for example: 150.00
[H] Leveling time, for example: 72 <这里指小时单位,需要转换>

The dataset type is returned, with each row (1 packages per 1 lines) containing the following 5 values:

[WorkID] Studio number, e.g. 48
[PID] Package number, for example: 512
[Ptitle] Package name, for example: XXXXXXXX
[Pri] Price, for example: 150.00
[H] Leveling time, for example: 72 <这里指小时单位,需要转换>

Look, the return should be an XML format string

      
 
          
  
   
    
   schema
  
   xml
 
  

PHP parsing XML has simplexml series, DOMDocument series, Sax series.
Look at the documentation yourself.

This is the return.
Object (StdClass) #2 (1) {["Return_packageresult"]=> object (StdClass) #3 (2) {["Schema"]=> string (716) "" ["any"]=& Gt String (1329) "68697" Leveling Hall "level 70-85 ★ 4000 Gold Five Prestige Respect ★ Pure Task 70.008468698" leveling Hall "" S11 Honor Battlefield Graduation "full set of weapons" 2-3 days "50.008468700" Leveling Hall " DNF Handmade Leveling Brush Section Brush Zun "any level-Zun 2" 40.002468715 "Leveling Hall" "1-80-level rapid recruitment" 2 days to complete the whole area of the full service 30.006068716 "leveling Hall" "1-85 class bag 135 yuan" send Big Bird Five prestige respect 135.00108 "}}

Oh, forget soapclient. Convert XML results to PHP object type.

Echo $p->return_packageresult->schema;
Echo $p->return_packageresult->any;

Thank you, the points to you, but there are a little bit of a small problem, can add a QQ to talk about it, more convenient. 285994968

Thank you, the points to you, but there are a little bit of a small problem, can add a QQ to talk about it, more convenient. 285994968
I am busy now, you do not knot, there is a problem here to ask, the heart of the altar friends will help you.

Return the following:
68697 "Leveling Hall" 70-85 level ★ 4000 Gold Five Prestige Respect ★ Pure Task 70.008468698 "leveling Hall" "S11 Honor Battlefield Graduation" full set of weapons "2-3 days" 50.008468700 "leveling Hall" DNF Manual leveling Brush Section Brush Zun "any level-2 "40.002468715" Leveling Hall "" 1-80-level Rapid recruitment version "2 days to complete the whole area of 30.006068716" Leveling Hall "" 1-85-class bag 135 yuan "send Big Bird five prestige respect 135.00108
Should be the following several parameters, how to get it separately?
68 715 "Leveling Hall" "1-80-level rapid recruitment" 2 days complete full-area full-service 30.00 60
68 716 "Leveling Hall" "1-85 class bag 135 yuan" send Big Bird Five prestige respect 135.00 108
Company ID Business Number content price time

Explode,sscanf ... Many functions can be used.

public class DAL
{
Public OracleConnection Getcon
{
Get
{
return new OracleConnection ("Data source=sajet_odac;user Id=sajet;password=tech");
}
}
public string testcondb ()
{
using (var con = getcon)
{
Try
{
Con. Open ();
OracleCommand cmd = new OracleCommand ("Select Sysdate from Dual", con);
OracleDataReader rd = cmd. ExecuteReader ();
if (Rd. Read ())
Return Rd. GetDateTime (0). ToString ();
Else
Return "Connect Dberror";
}
catch (Exception ee)
{
Return EE. Message;
}
Finally
{
Con. Close ();
}
}
[WebMethod]
public string Getsysdate ()
{
Dal d =new dal ();
return D.testcondb ();
}
====== calling code

private void Button1_Click (object sender, EventArgs e)
{
Servicereference1.tsajetservercesoapclient client = new Servicereference1.tsajetservercesoapclient ();
MessageBox.Show (client. Getsysdate ());


}
=============== Exception Hints
Server was unable to process request. ---> Object reference not set to a instance of an Object.
===== instructions for local calls there is no problem putting the webservice on the IIS server it's not going to go. Please enlighten the gods.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.