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);//结果从这里分析
有一个方法叫Retrun_Package,要传三个参数,分别是用户名,密码和调用的条数,此处我用的XXX代替,但最后却报错了,我对PHP不是很熟悉,望各位指正。
回复讨论(解决方案)
UN PS两个参数换成正常合法的试试看
我使用正常的时候提示如下错误:
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 an instance of an object. at WebService1.WebLocalData.Return_Package(String UN, String PS, Int32 TopCount) in F:\开发相关\网站\测试服务-对外测试\对代练堂服务\WebService1\WebService1\WebLocalData.asmx.cs:line 26 --- End of inner exception stack trace --- in E:\APM\APMServ5.2.6\www\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封装没啥好感,太透明了,错误提示坑爹,不过这个例子我觉得你得改成这样
$client = new SoapClient("http://s.dailiangu.com:8011/WebLocalData.asmx?WSDL");$p = $client->Return_Package(array('UN'=>'xxxxxxx','PS'=>'xxxxxxx','TopCount'=>'5'));
还不行,直接上curl或者fsockopen按照
http://s.dailiangu.com:8011/WebLocalData.asmx?op=Return_Package
给出的请求协议格式请求过去。
已经可以了,非常感谢,原来如此。我明白了。那么怎么获取里面的参数呢,假如返回的有一个id这个参数,怎么获得呢?
返回的是DataSet 类型,里面每一行(每1行就是1笔套餐)包括以下5个值:
[WorkID] 工作室编号,例如48
[PID]套餐编号,例如:512
[Ptitle]套餐名称,例如:XXXXXXXX
[Pri]价格,例如:150.00
[H]代练时间,例如:72
返回的是DataSet 类型,里面每一行(每1行就是1笔套餐)包括以下5个值:
[WorkID] 工作室编号,例如48
[PID]套餐编号,例如:512
[Ptitle]套餐名称,例如:XXXXXXXX
[Pri]价格,例如:150.00
[H]代练时间,例如:72
看了下,返回的应该是个xml格式串
<Return_PackageResult> <xsd:schema>schema</xsd:schema>xml</Return_PackageResult>
php解析xml的有simplexml系列,DOMDocument系列,Sax系列 。。
这个你自己看着文档搞搞吧。
返回的是这样的
object(stdClass)#2 (1) { ["Return_PackageResult"]=> object(stdClass)#3 (2) { ["schema"]=> string(716) "" ["any"]=> string(1329) "68697【代练堂】70-85级★赠4000金五大声望尊敬★纯任务70.008468698【代练堂】【S11荣誉战场毕业】全套加武器【秒排2-3天】50.008468700【代练堂】dnf手工代练刷段刷尊【任意等级-尊2】40.002468715【代练堂】【1-80级急速招募版】2天完成 全区全服30.006068716【代练堂】【1-85级包卡135元】送大鸟五大声望尊敬135.00108" } }
哦,忘了soapClient帮我们将xml结果转成php对象类型了。
echo $p->Return_PackageResult->schema;
echo $p->Return_PackageResult->any;
谢谢你,把分给你,但还有一点点小小的问题,可否加个QQ谈呢,比较方便。285994968
谢谢你,把分给你,但还有一点点小小的问题,可否加个QQ谈呢,比较方便。285994968
我这就开忙了,你先别结贴,有问题这里问,有心的坛友会帮你的。
返回的如下:
68697【代练堂】70-85级★赠4000金五大声望尊敬★纯任务70.008468698【代练堂】【S11荣誉战场毕业】全套加武器【秒排2-3天】50.008468700【代练堂】dnf手工代练刷段刷尊【任意等级-尊2】40.002468715【代练堂】【1-80级急速招募版】2天完成 全区全服30.006068716【代练堂】【1-85级包卡135元】送大鸟五大声望尊敬135.00108
应该是如下几个参数,怎么分别获得呢?
68 715 【代练堂】【1-80级急速招募版】2天完成 全区全服 30.00 60
68 716 【代练堂】【1-85级包卡135元】送大鸟五大声望尊敬 135.00 108
公司编号 业务单号 内容 价格 时间
explode,sscanf...很多函数可以用。
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();
}
======调用代码
private void button1_Click(object sender, EventArgs e)
{
ServiceReference1.TsajetServerceSoapClient client = new ServiceReference1.TsajetServerceSoapClient();
MessageBox.Show(client.GetSysdate());
}
===============异常提示
Server was unable to process request. ---> Object reference not set to an instance of an object.
=====说明在 本地调用是没有问题的 把webservice 放到 IIS 服务器上 就不行了 请指点下各位大神。。

Reasons for PHPSession failure include configuration errors, cookie issues, and session expiration. 1. Configuration error: Check and set the correct session.save_path. 2.Cookie problem: Make sure the cookie is set correctly. 3.Session expires: Adjust session.gc_maxlifetime value to extend session time.

Methods to debug session problems in PHP include: 1. Check whether the session is started correctly; 2. Verify the delivery of the session ID; 3. Check the storage and reading of session data; 4. Check the server configuration. By outputting session ID and data, viewing session file content, etc., you can effectively diagnose and solve session-related problems.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

Configuring the session lifecycle in PHP can be achieved by setting session.gc_maxlifetime and session.cookie_lifetime. 1) session.gc_maxlifetime controls the survival time of server-side session data, 2) session.cookie_lifetime controls the life cycle of client cookies. When set to 0, the cookie expires when the browser is closed.

The main advantages of using database storage sessions include persistence, scalability, and security. 1. Persistence: Even if the server restarts, the session data can remain unchanged. 2. Scalability: Applicable to distributed systems, ensuring that session data is synchronized between multiple servers. 3. Security: The database provides encrypted storage to protect sensitive information.

Implementing custom session processing in PHP can be done by implementing the SessionHandlerInterface interface. The specific steps include: 1) Creating a class that implements SessionHandlerInterface, such as CustomSessionHandler; 2) Rewriting methods in the interface (such as open, close, read, write, destroy, gc) to define the life cycle and storage method of session data; 3) Register a custom session processor in a PHP script and start the session. This allows data to be stored in media such as MySQL and Redis to improve performance, security and scalability.

SessionID is a mechanism used in web applications to track user session status. 1. It is a randomly generated string used to maintain user's identity information during multiple interactions between the user and the server. 2. The server generates and sends it to the client through cookies or URL parameters to help identify and associate these requests in multiple requests of the user. 3. Generation usually uses random algorithms to ensure uniqueness and unpredictability. 4. In actual development, in-memory databases such as Redis can be used to store session data to improve performance and security.

Managing sessions in stateless environments such as APIs can be achieved by using JWT or cookies. 1. JWT is suitable for statelessness and scalability, but it is large in size when it comes to big data. 2.Cookies are more traditional and easy to implement, but they need to be configured with caution to ensure security.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version
SublimeText3 Linux latest version
