GVKun编程网logo

PHP肥皂的用法(shop肥皂)

8

在本文中,我们将给您介绍关于PHP肥皂的用法的详细内容,并且为您解答shop肥皂的相关问题,此外,我们还将为您提供关于NuSoap与PHP肥皂库.getError在哪里?、php5.3中的类的别名的用

在本文中,我们将给您介绍关于PHP肥皂的用法的详细内容,并且为您解答shop肥皂的相关问题,此外,我们还将为您提供关于NuSoap与PHP肥皂库. getError在哪里?、php 5.3中的类的别名的用法_PHP教程、php at(@)符号的用法简介_php技巧、php at(@)符号的用法简介_PHP教程的知识。

本文目录一览:

PHP肥皂的用法(shop肥皂)

PHP肥皂的用法(shop肥皂)

我正在试图通过SOAP插入远程服务器的数据.但得到以下错误:

object(stdClass)#3(1){[“DataInsertResult”] => string(51)“Hata:DI – 值不能为空.参数名称:s”}

在这里你可以找到我的代码如下:

<?PHP
$client = new SoapClient("http://www.posta-tr.com/MassDataAccepter/MassDataAccepter.asmx?wsdl");
$connect = $client->Authenticate("accountname","password");

$send = $client->DataInsert(array(
"idRoot" => array (
    "DataToDb" => array(
        "Drow" => array (
            "FName" => "George","LName" => "Houston","Email" => "gerorge@emailprovider.com","InvitedBy" => "Mary J","Job" => "Architect","City" => "Newyork",)
    ) 
)

));
var_dump($send);
echo $client->DataInsertResponse;
?>

我怎么能解决这个问题?

嗨,在这里你可以看到我的webservice提供者的.net(?)代码.我如何使用它作为PHP代码?

Webservice Url: http://www.posta-tr.com/MassDataAccepter/MassDataAccepter.asmx?wsdl

protected void btn_Save_Click(object sender,EventArgs e)
    {
        PwebS.MassDataAccepter mda = new PwebS.MassDataAccepter();
        string Result = "Error!";
        string Token = mda.Authenticate("user","pass");
        string data = @"<idRoot>
<DataToDb>
<Drow>
<FName>George</FName>
<LName>Houston</LName>
<Email>gerorge@emailprovider.com</Email>
<InvitedBy>Mary J</InvitedBy>
<Job>Architect</Job>
<City>Newyork</City>
</Drow>
</DataToDb>
</idRoot>";

        if (Token.Length > 30)
        {
            Result = mda.DataInsert(Token,data);
        }
        if (Result.Contains("Inserted : 1"))
            lbl_Info.Text = "Data Inserted!";
        else if (Result.Contains("Updated : 1"))
            lbl_Info.Text = "There is same data in db! Duplicate Data!";
        else
            lbl_Info.Text = "Error!";
    }

嗨,几天后我得到一个有趣的消息… PHP_soap无法连接web服务但nusoap工作正常!下面你可以看到我的代码,但我得到一个新的错误,你可以看到代码后的错误:)

<?PHP
require_once('includes/nusoap/nusoap.PHP');
$client = new nusoap_client("http://www.posta-tr.com/MassDataAccepter/MassDataAccepter.asmx?wsdl","wsdl","","");
$err = $client->getError();
if ($err) {
echo "<h2>Constructor error</h2><pre>" . $err . "</pre>";
}
$params = array(
    'Username'=>'my_username','Password'=>'my_password'
);
$result = $client->call("Authenticate",$params,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);
$tokenkey = $result['AuthenticateResult'];
echo $tokenkey;
echo "</pre>";
}
}
$veri = "<idRoot>
    <DataToDb>
    <Drow>
    <FName>George</FName>
    <LName>Houston</LName>
    <Email>gerorge@emailprovider.com</Email>
    <InvitedBy>Mary J</InvitedBy>
    <Job>Architect</Job>
    <City>Newyork</City>
    </Drow>
    </DataToDb>
    </idRoot>";
echo "<hr />";
$send = $client->call("DataInsert",$tokenkey,$veri);
var_dump($send);
?>

结果:

Result

    Array
    (
        [AuthenticateResult] => 92528146-183B-4651-B852-6A1C97F1E908
    )

92528146-183B-4651-B852-6A1C97F1E908 //This means we connect the webservice and we got "token"
bool(false) //This means there is an error in data

解决方法

这看起来像一个.NET错误,你无法在PHP端解决它.但也许缺少一个参数.

例如 :
如果我的功能为

public void DataInsert(string test1,string s)

如果s作为null传递.net将抛出一个错误,因为“值不能为null.参数名称:s”}“

http://www.posta-tr.com/MassDataAccepter/MassDataAccepter.asmx?op=DataInsert

<DataInsert xmlns="http://tempuri.org/">
      <Token>string</Token>
      <Data>string</Data>
    </DataInsert>

我认为Data或Token为null,你只传递了1个参数,现在Data为null,
尝试发送2个参数,首先是Token,Second是Data.

<?PHP
$client = new SoapClient("http://www.posta-tr.com/MassDataAccepter/MassDataAccepter.asmx?wsdl");
$connect = $client->Authenticate("accountname","password");

$data = "<idRoot>
            <DataToDb>
            <Drow>
            <FName>George</FName>
            <LName>Houston</LName>
            <Email>gerorge@emailprovider.com</Email>
            <InvitedBy>Mary J</InvitedBy>
            <Job>Architect</Job>
            <City>Newyork</City>
            </Drow>
            </DataToDb>
            </idRoot>";

$send = $client->DataInsert($connect->AuthenticateResult,$data);
var_dump($send);

?>

Selamlar(:

NuSoap与PHP肥皂库. getError在哪里?

NuSoap与PHP肥皂库. getError在哪里?

我正在将使用NuSoap的旧代码转换为 PHP Soap Library.但是在PHP Soap Libary中似乎不存在NuSoap PHP中的方法getError,我收到此错误:
Fatal error: Uncaught SoapFault exception: 
[Client] Function ("getError") is not a valid method for this service in index.PHP:33
Stack trace: #0 index.PHP(33): SoapClient->__call('getError',Array) #1 index.PHP(33):
SoapClient->getError() #2 index.PHP(63): pay() #3 {main} thrown in /homeindex.PHP on line 33

这是我的代码:

<?PHP
    $client = new SoapClient('my soap server');
    $err = $client->getError();
?>

我应该如何在PHP Soap库中获得错误?

<?PHP
    $client = new SoapClient('my soap server');
    $err = $client->soapCall($somfunctioname,$arrofargs );

?>

如果有任何错误它与soapCall.它返回一个SoapFault()实例,您可以在其中记录错误代码,说明所以..上

http://www.php.net/manual/en/soapclient.soapcall.php

php 5.3中的类的别名的用法_PHP教程

php 5.3中的类的别名的用法_PHP教程

在PHP 5.3中,要是想引入一些类的名字很长的话,书写起来比较麻烦,这个时候
可以用PHP 5.3的类的别名的用法,举例说明如下:

class Irrational_Long_Class_Name
{
// empty class
}

class_alias(Irrational_Long_Class_Name, ShortAlias);

$shortAliasInstance = new ShortAlias();
var_dump( $shortAliasInstance instanceof Irrational_Long_Class_Name);
# true
var_dump( $shortAliasInstance instanceof ShortAlias);
# true


可以用get_class()获得原先真实的类名,比如:
class Irrational_Long_Class_Name
{

public function getClass()
{
print get_class();
}
}

class_alias(Irrational_Long_Class_Name, ShortAlias);

$aInstanceWithAlias = new ShortAlias();

$aInstanceWithAlias->getClass();
#  Irrational_Long_Class_Name
print get_class($aInstanceWithAlias);
# Irrational_Long_Class_Name


还可以在FUNCTION中,直接使用别名类,比如:
  class TestClass
{
public function doSomethingWithShortAliasInstance(ShortAlias $b) { }
}
class_alias(Irrational_Long_Class_Name, ShortAlias);
$aInstanceWithAlias = new ShortAlias();
$testClassInstance = new TestClass();
$testClassInstance->doSomethingWithShortAliasInstance($aInstanceWithAlias);

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478769.htmlTechArticle在PHP 5.3中,要是想引入一些类的名字很长的话,书写起来比较麻烦,这个时候 可以用PHP 5.3的类的别名的用法,举例说明如下: class Irrational_Long...

php at(@)符号的用法简介_php技巧

php at(@)符号的用法简介_php技巧

下面介绍一下它的用法.

例如:

复制代码 代码如下:

function db_connect()//连接数据库
{
@$db =mysql_connect(''localhost'',''root'',''test'');
if(!$db)
throw new Exception(''连接数据库失败!请重试!'');
mysql_select_db(''book'');
return $db;
}

如果连接数据库不成功的,前面的“@”就能把错误显示给抑制住,也就是不会显示错误,然后再抛出异常,显示自己定义的异常处理,添加这个只是为了让浏览者不看到,不友好的页面,并不能抑制住错误,只能抑制显示错误!@ 用在你觉得以后运行有可能会出现错误的地方 , @后面要来个空格!最好少用,好像增加系统开销.

php at(@)符号的用法简介_PHP教程

php at(@)符号的用法简介_PHP教程

下面介绍一下它的用法.

例如:

复制代码 代码如下:

function db_connect()//连接数据库
{
@$db =mysql_connect(''localhost'',''root'',''test'');
if(!$db)
throw new Exception(''连接数据库失败!请重试!'');
mysql_select_db(''book'');
return $db;
}

如果连接数据库不成功的,前面的“@”就能把错误显示给抑制住,也就是不会显示错误,然后再抛出异常,显示自己定义的异常处理,添加这个只是为了让浏览者不看到,不友好的页面,并不能抑制住错误,只能抑制显示错误!@ 用在你觉得以后运行有可能会出现错误的地方 , @后面要来个空格!最好少用,好像增加系统开销.

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/320296.htmlTechArticle下面介绍一下它的用法. 例如: 复制代码 代码如下: function db_connect()//连接数据库 { @$db =mysql_connect(''localhost'',''root'',''test''); if(!$db) throw new Except...

我们今天的关于PHP肥皂的用法shop肥皂的分享就到这里,谢谢您的阅读,如果想了解更多关于NuSoap与PHP肥皂库. getError在哪里?、php 5.3中的类的别名的用法_PHP教程、php at(@)符号的用法简介_php技巧、php at(@)符号的用法简介_PHP教程的相关信息,可以在本站进行搜索。

本文标签:

上一篇php – cURL将数据发布到asp.net页面(php curl文件上传)

下一篇php – 在Codeigniter购物车类中添加到购物车(php加入购物车代码)