I am getting below error after requesting SOAP call.
fault code: HTTP, fault string: Bad Request
Is this badly formed message?
try{
$client = new SoapClient("http://ip_add/something.asmx?WSDL", array("trace" => true, 'exceptions' => 1));
$params = new \SoapVar('<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<RemittanceService xmlns="http://tempuri.org/">
<CreditTxnMessage xmlns="http://my_url">
<Corporate_UID xmlns="">66666</Corporate_UID>
<Mandate_Type xmlns="">P</Mandate_Type>
<MICR_No xsi:nil="true" xmlns="" />
<Instrument_No xsi:nil="true" xmlns="" />
<Remitter_Address1 xmlns="">285 enfiled pl</Remitter_Address1>
<Remitter_Address2 xmlns="">mississauga</Remitter_Address2>
<Remitter_Address3 xmlns="">16y2n4</Remitter_Address3>
<Remitter_Country xmlns="">Canada</Remitter_Country>
<Remitter_ZIP_Code xsi:nil="true" xmlns="" />
<Remitter_EmailID xsi:nil="true" xmlns="" />
<Remitter_Contact_No xmlns="" />
<Beneficiary_ZIP_Code xsi:nil="true" xmlns="" />
<Beneficiary_EmailID xsi:nil="true" xmlns="" />
<Beneficiary_Contact_No xmlns="" />
<Beneficiary_Bank_Name xmlns="">PNB</Beneficiary_Bank_Name>
</CreditTxnMessage>
</RemittanceService>
</soap:Body>
</soap:Envelope>', XSD_ANYXML);
$result = $client->__soapCall('RemittanceService', array($params));
highlight_string($client->__getLastRequest());
}
catch(SoapFault $fault){
die("SOAP Fault:<br />fault code: {$fault->faultcode}, fault string: {$fault->faultstring}");
}
I don't know what's wrong here.
Stack Trace
SoapFault exception: [HTTP] Bad Request in /var/www/mtes/public_html/application/controllers/bank_api_pnb.php:146
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://124.124....', 'http://tempuri....', 1, 0)
#1 /var/www/mtes/public_html/application/controllers/bank_api_pnb.php(146): SoapClient->__soapCall('RemittanceServi...', Array)
#2 [internal function]: Bank_api_pnb->test()
#3 /var/www/mtes/public_html/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#4 /var/www/mtes/public_html/index.php(220): require_once('/var/www/mtes/p...')
#5 {main}
The whole point of the SoapClient is to convert calls to xml; so you shouldn't be doing this manually. Try this instead:
try {
$client = new SoapClient("http://ip_add/something.asmx?WSDL", array("trace" => true, 'exceptions' => 1));
$result = $client->RemittanceService(array(
'CreditTxnMessage' => array(
'Corporate_UID' => 66666,
'Mandate_Type' => 'P',
'MICR_No' => null,
/* you get the idea */
'Beneficiary_Contact_No' => '',
'Beneficiary_Bank_Name' => 'PNB'
)
));
highlight_string($client->__getLastRequest());
}
catch(SoapFault $fault){
die("SOAP Fault:<br />fault code: {$fault->faultcode}, fault string: {$fault->faultstring}");
}
The exact format of the parameters and their names would be specified in the WSDL.
Generally a Bad Request response to a SOAP request is returned when the message is not in a good format (invalid header, body, ..) and therefor the document can't be parsed. First of all try to remove the XML version declaration from your SoapVar and see if it fixes the problem (remove the line below):
<?xml version="1.0" encoding="UTF-8"?>
Alternatively you can always test your Soap requests in tools like SoapUI to make sure they work and then complete your code. If it doesn't work in SoapUI it means there is something wrong with the request. Try to revise the WS and make sure you are sending everything in the correct format (eg. maybe you need to authenticate? SoapHeader? ..)
I am not to familiar with PHP but try this.
$Request = '<RemittanceService xmlns="http://tempuri.org/">
<CreditTxnMessage xmlns="http://my_url">
<Corporate_UID xmlns="">66666</Corporate_UID>
<Mandate_Type xmlns="">P</Mandate_Type>
<MICR_No xsi:nil="true" xmlns="" />
<Instrument_No xsi:nil="true" xmlns="" />
<Remitter_Address1 xmlns="">285 enfiled pl</Remitter_Address1>
<Remitter_Address2 xmlns="">mississauga</Remitter_Address2>
<Remitter_Address3 xmlns="">16y2n4</Remitter_Address3>
<Remitter_Country xmlns="">Canada</Remitter_Country>
<Remitter_ZIP_Code xsi:nil="true" xmlns="" />
<Remitter_EmailID xsi:nil="true" xmlns="" />
<Remitter_Contact_No xmlns="" />
<Beneficiary_ZIP_Code xsi:nil="true" xmlns="" />
<Beneficiary_EmailID xsi:nil="true" xmlns="" />
<Beneficiary_Contact_No xmlns="" />
<Beneficiary_Bank_Name xmlns="">PNB</Beneficiary_Bank_Name>
</CreditTxnMessage>
</RemittanceService>';
$result = $client->__doRequest($Request, "http://ip_add/something.asmx", "RemittanceService", soap_1_2, 0);
I'm not sure how SoapVar works, but I would advise against passing in raw XML to the SoapClient. I would try to recreate the XML structure in PHP arrays (painful, I know), especially since the XML appears in the stack trace:
$params = array(
"RemittanceService" => array("xmlns"=>"http://tempuri.org/", "_" => array(
"CreditTxnMessage" => array("xmlns" => "http://my_url", "_" => array(
"Corporate_UID" => array("xmlns" => "", "_" => 66666),
"Mandate_Type" => array("xmlns" => "", "_" => "P"),
"MICR_No" => array("xsi:nil" => "true", "xmlns" => ""),
// and so on...
))
))
);
Also, you should probably specify the SOAP version (SOAP_1_1 or SOAP_1_2) in the constructor of the SOAPClient:
$client = new SoapClient("http://ip_add/something.asmx?WSDL", array('soap_version' => SOAP_1_2, "trace" => true, 'exceptions' => 1));
Also, the arguments array in __soapCall() is pretty picky about the formatting. Try the following:
$result = $client->__soapCall('RemittanceService', array('parameters' => $params));
Or even:
$result = $client->__soapCall('RemittanceService', $params);
I'm basically guessing as to what the issue is, so this isn't a very thorough solution. You can also try looking elsewhere on SO. For example, this answer uses SoapVar.
Related
I am trying to make a SOAP call using POSTMAN that will duplicate a call I'm making with a PHP code for testing purposes, but I am getting a "Bad request" error message, so I assume my conversion is incorrect.
The PHP code is:
//Create xml string
$xml=new DomDocument();
$xml->createCDATASection('![CDATA[]]');
$xml->encoding = 'utf-8';
$xml->xmlVersion = '1.0';
$xml->formatOutput = true;
$xsd=$xml->createElement("xsd:schema");
$xml->appendChild($xsd);
$xsdattr=new DOMAttr("xmlns:xsd","http://www.w3.org/2001/XMLSchema");
$xsd->setAttributeNode($xsdattr);
$ZHT=$xml->createElement("ZHT",str_replace(" ","",$username));
$xsd->appendChild($ZHT);
$PASSWORD=$xml->createElement("PASSWORD",str_replace(" ","",$pwd));
$xsd->appendChild($PASSWORD);
$SNL=$xml->createElement("SNL",$date);
$xsd->appendChild($SNL);
$USERNAME=$xml->createElement("USERNAME","");
$xsd->appendChild($USERNAME);
$RETHASIMA=$xml->createElement("RETHASIMA","1");
$xsd->appendChild($RETHASIMA);
$LANG=$xml->createElement("LANG","");
$xsd->appendChild($LANG);
$ROLE=$xml->createElement("ROLE",$role);
$xsd->appendChild($ROLE);
$xmlstring=$xml->saveXML();
//Set SOAP request
$baseURL=$url;
$arrContextOptions=array("ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false,'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT));
$options = array(
'soap_version' => SOAP_1_1,
'trace' => true,
'exceptions' => true, // disable exceptions
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'encoding' => 'UTF-8',
'cache_wsdl'=>WSDL_CACHE_NONE,
);
$client = new SoapClient($baseURL."?wsdl", $options);
$p=array(
"P_RequestParams" => array (
"RequestID"=>"48",
"InputData"=>$xmlstring
) ,
"Authenticator" => array (
"Password"=>$authpass,
"UserName"=>$authuser
),
);
//SOAP call and response
$response=$client->ProcessRequestJSON($p);
And This is the body I created in POSTMAN:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProcessRequestJSON xmlns="****">
<P_RequestParams>
<RequestID>48</RequestID>
<InputData>
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PARAMS>
<ZHT>****</ZHT>
<PASSWORD>****</PASSWORD>
<SNL>***</SNL>
<USERNAME></USERNAME>
<RETHASIMA>1</RETHASIMA>
<LANG></LANG>
<ROLE>1</ROLE>
</PARAMS>
</schema>
</InputData>
</P_RequestParams>
<Authenticator>
<UserName>****</UserName>
<Password>****</Password>
</Authenticator>
</ProcessRequestJSON>
</soap:Body>
</soap:Envelope>
I'm not sure how to set certain things on POSTMAN.
For example, the following line:
$xsdattr=new DOMAttr("xmlns:xsd","http://www.w3.org/2001/XMLSchema");
How do I set a DOMAttr in POSTMAN?
Or the options?
I set up the headers for XML:
Content-Type: text/xml
SOAPAction: "****/ProcessRequestJSON"
Body: Raw (XML)
I tried putting the inner XML (inside the tag) in "" to indicate a string, but that didn't work either.
The PHP code works correctly, the SOAP call is successful and returns a correct response.
The POSTMAN request returns a "Bad Request" error message.
I have to make a script that sends a order (XML) to a SOAP client server (this way the supplier can handle the order)
I tried everything but it doesn't work.
Does anybody know what I'm doing wrong?
This is what I have so far:
<?php
$xmlstr = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.datacontract.org/2004/07/Centric.CS.Trade.Standard.WS.SalesOrderService.Contract.Request" xmlns:ns2="http://centric.eu/services/CS/Trade/Standard/WS/">
<SOAP-ENV:Body>
<ns2:LoadSalesOrder>
<ns2:request>
<ns1:SalesOrderRequests>
<ns1:SalesOrderRequest>
<ns1:DeliveryAddress/>
<ns1:DeliveryAddress1>teststraat</ns1:DeliveryAddress1>
<ns1:DeliveryCountry>NL</ns1:DeliveryCountry>
<ns1:DeliveryEmail>test#test.nl</ns1:DeliveryEmail>
<ns1:DeliveryFetchCarrier>true</ns1:DeliveryFetchCarrier>
<ns1:DeliveryFetchDeliveryMode>true</ns1:DeliveryFetchDeliveryMode>
<ns1:DeliveryHouseNo>1</ns1:DeliveryHouseNo>
<ns1:DeliveryMunicipality>ALKMAAR</ns1:DeliveryMunicipality>
<ns1:DeliveryName>Test naam</ns1:DeliveryName>
<ns1:DeliveryPermanent>false</ns1:DeliveryPermanent>
<ns1:DeliveryPhone>06-12345678</ns1:DeliveryPhone>
<ns1:DeliveryPostalCode>1200 RT</ns1:DeliveryPostalCode>
<ns1:Division>AGU_NL</ns1:Division>
<ns1:Key>02</ns1:Key>
<ns1:Language>NL</ns1:Language>
<ns1:Login>7440475</ns1:Login>
<ns1:OrderCustomer>7440475</ns1:OrderCustomer>
<ns1:OrderLines>
<ns1:SalesOrderRequest.OrderLine>
<ns1:Item>113504</ns1:Item>
<ns1:Line>10</ns1:Line>
<ns1:OrderQuantityBU>1.0000</ns1:OrderQuantityBU>
</ns1:SalesOrderRequest.OrderLine>
</ns1:OrderLines>
<ns1:OrderType>100</ns1:OrderType>
<ns1:ReferenceExternal>100000001</ns1:ReferenceExternal>
</ns1:SalesOrderRequest>
</ns1:SalesOrderRequests>
</ns2:request>
</ns2:LoadSalesOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;
$wsdl = 'https://ws.abcb2b.eu/Centric/CS/Trade/cstest/SalesOrderService.svc?wsdl';
$client = new SoapClient($wsdl, array(
'cache_wsdl' => WSDL_CACHE_NONE,
'cache_ttl' => 86400,
'trace' => true,
'exceptions' => true,
));
$xmlVar = new SoapVar($xmlstr, XSD_ANYXML);
$client->LoadSalesOrder($xmlstr);
?>
Fatal error: Uncaught SoapFault exception: [s:Client] The creator of this fault did not specify a Reason. in C:\wamp\soap_request.php:102 Stack trace: #0 C:\wamp\www\soap_request.php(102): SoapClient->__call('LoadSalesOrder', Array) #1 C:\wamp\www\soap_request.php(102): SoapClient->LoadSalesOrder('
i am trying to make a Soap request i says this error :
Uncaught SoapFault exception: [HTTP] Bad Request in C:\
<?php
$client = new SoapClient(null, array('location' => "http://webservices.micros.com/ows/5.1/Availability.wsdl#FetchCalendar",
'uri' => "http://###.###.###.##:8080/ows_ws_51/Availability.asmx?wsdl"));
//print_r($client);
$para = array('StayDateRange' => array('StartDate' => '2013-10-01','EndDate' => '2013-10-10'),'GuestCount'=>array('GuestCountageQualifyingCode'=>'ADULT','GuestCountageQualifyingCode'=>'CHILD'));
$ns = 'http://webservices.micros.com/og/4.3/Availability/'; //Namespace of the WS.
//Body of the Soap Header.
$headerbody = array('OriginentityID' => 'OWS',
'DestinationentityID' => 'WEST',
'systemType'=>'WEB',
'systemType'=>'ORS');
//Create Soap Header.
$header = new SOAPHeader($ns, 'OGHeader', $headerbody);
//set the Headers of Soap Client.
$client->__setSoapHeaders($header);
$client->__soapCall("FetchCalendar", $para);
?>
whats wrong in my code ?
after adding Exception handling :
http://postimg.org/image/6w9lmac1d/
EDIT: XML Added
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<OGHeader transactionID="005435" timeStamp="2008-12-09T13:26:56.4056250-05:00" xmlns="http://webservices.micros.com/og/4.3/Core/">
<Origin entityID="OWS" systemType="WEB" />
<Destination entityID="WEST" systemType="ORS" />
</OGHeader>
</soap:Header>
<soap:Body>
<FetchCalendarRequest xmlns:a="http://webservices.micros.com/og/4.3/Availability/" xmlns:hc="http://webservices.micros.com/og/4.3/HotelCommon/" xmlns="http://webservices.micros.com/ows/5.1/Availability.wsdl">
<HotelReference chainCode="AXA" hotelCode="AXAMUM" />
<StayDateRange>
<hc:StartDate>2013-10-01</hc:StartDate>
<hc:EndDate>2013-10-10</hc:EndDate>
</StayDateRange>
<GuestCount>
<hc:GuestCount ageQualifyingCode="ADULT" count="1" />
<hc:GuestCount ageQualifyingCode="CHILD" count="0" />
</GuestCount>
</FetchCalendarRequest>
</soap:Body>
</soap:Envelope>
I believe there are 2 layer of problem, first you didn't catch the exception when it is thrown. second you request might be incorrect/invalid that's why it returns 400 bad request
try{
$client->__soapCall("FetchCalendar", $para);
}catch (SoapFault $exception){
//or any other handling you like
var_dump(get_class($exception));
var_dump($exception);
}
I'm trying to pass a fairly complex parameter string which I have an XML example of and I'm trying to encode it properly using PHP. The example request I was given is this:
<?xml version="1.0" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body xmlns:tns="http://172.16.53.121/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://www.amtrak.com/TrainStatus/2006/01/01" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsdns1="http://www.amtrak.com/schema/2006/01/01" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<TrainStatusRQ xmlns="http://www.amtrak.com/schema/2006/01/01" xmlns:ota="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="1.0" EchoToken="TestToken">
<POS>
<ota:Source>
<ota:RequestorID Type="WAS" ID="ToBeProvidedByAmtrak">
<ota:CompanyName CompanyShortName="ToBeProvidedByAmtrak"/>
</ota:RequestorID>
</ota:Source>
</POS>
<TrainStatusInfo TrainNumber="3">
<TravelDate>
<ota:DepartureDateTime>2006-01-07</ota:DepartureDateTime>
</TravelDate>
<Location LocationCode="KNG"/>
</TrainStatusInfo>
</TrainStatusRQ>
</SOAP-ENV:Body>
And I'm going to call it use it like this
try
{
$client = new SoapClient($soapURL, $soapOptions);
$trainStatus = $client->processTrainStatus($TrainStatusRQ);
var_dump($trainStatus);
//var_dump($client->__getTypes());
}
catch(SoapFault $e)
{
echo "<h2>Exception Error!</h2></b>";
echo $e->faultstring;
}
Its the encoding of $TrainStatusRQ that I cant seem to figure out since there are attributes and multilevel parameters. This is as close as I have gotten.
$RQStruc = array(
"POS" => array(
"Source"=> array(
"RequestorID" => array(
'type'=>'WAS',
'ID'=>'0',
'CompanyName'=>array(
'CompanyShortName'=>"0"
)
)
)
),
"TrainStatusInfo" => array(
'TrainNumber'=>$TrainNumber,
'TravelDate' => array(
'DepartureDateTime' => array(
'_' => $today
)
),
"Location" => array(
'LocationCode'=>$LocationCode
)
)
);
$TrainStatusRQ = new SoapVar($RQStruc, XSD_ANYTYPE, "TrainStatusRQ","http://www.amtrak.com/schema/2006/01/01" );
I had similar problems when dealing with a .NET service.
What I ended up with was assembling the structure as plain string.
$p = array();
foreach ($items as $item) {
$p[] = "
<MyEntity class='entity'> // the attribute was required by .NET
<MyId>{$item->SomeID}</MyId>
<ItemId>{$item->ItemId}</ItemId>
<Qty>{$item->Qty}</Qty>
</MyEntity>";
}
$exp = implode("\n", $p);
$params['MyEntity'] = new \SoapVar("<MyEntity xmlns='http://schemas.microsoft.com/dynamics/2008/01/documents/MyEntity'>$exp</MyEntity>", XSD_ANYXML);
Worked without problems.
Passing in the XML as a string with XSD_ANYXML as the type was the answer. I also needed to leave out the third and fourth parameters in the SoapVar() function call.
$XML = '<TrainStatusRQ xmlns="http://www.amtrak.com/schema/2006/01/01" xmlns:ota="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="1.0" EchoToken="TestToken">
<POS>
<ota:Source>
<ota:RequestorID Type="WAS" ID="foo">
<ota:CompanyName CompanyShortName="bat"/>
</ota:RequestorID>
</ota:Source>
</POS>
<TrainStatusInfo TrainNumber="'.$TrainNumber.'">
<TravelDate>
<ota:DepartureDateTime>'.$Today.'</ota:DepartureDateTime>
</TravelDate>
</TrainStatusInfo>
</TrainStatusRQ>';
$TrainStatusRQ = new SoapVar($XML,XSD_ANYXML);
I'm trying to login to an API using built-in soap functions of PHP. I got a result like this.
[LoginResult]=> false,
[ErrorMsg] => Login failed with the reason : The security object is invalid
This is what required by the API provider.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Login xmlns="http://tempuri.org/Example/Service1">
<objSecurity>
<WebProviderLoginId>test</WebProviderLoginId>
<WebProviderPassword>test</WebProviderPassword>
<IsAgent>false</IsAgent>
</objSecurity>
<OutPut />
<ErrorMsg />
</Login>
</soap:Body>
</soap:Envelope>
&, here is what I was able to produce using functions.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/Example/Service1">
<SOAP-ENV:Body>
<ns1:Login>
<objSecurity>
<WebProviderLoginId>test</WebProviderLoginId>
<WebProviderPassword>test</WebProviderPassword>
<IsAgent>false</IsAgent>
</objSecurity>
<OutPut/>
<ErrorMsg/>
</ns1:Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the code I used to send the request.
<?php
class objSecurity {
function objSecurity($s, $i, $f) {
$this->WebProviderLoginId = $s;
$this->WebProviderPassword = $i;
$this->IsAgent = $f;
}
}
class nextObject {
function nextObject($objSecurity) {
$this->objSecurity=$pobjSecurity;
$this->OutPut=NULL;
$this->ErrorMsg=NULL;
}
}
$url = 'http://example.com/sampleapi/test.asmx?WSDL';
$client = new SoapClient($url, array("soap_version" => SOAP_1_1,"trace" => 1));
$struct = new objSecurity('test', 'test', false);
$data = new nextObject($struct);
$soapstruct2 = new SoapVar($data, SOAP_ENC_OBJECT);
print_r(
$client->__soapCall(
"Login",
array(new SoapParam($soapstruct2, "inputStruct"))
)
);
echo $client->__getLastRequest();
?>
These are the differences I found.
In my request xmlns:xsi is missing.
Requirement starts with <soap:Envelope, But my request starts with <SOAP-ENV:Envelope.
There is an extra xmlns:ns1 in my request.
& The function name tag starts with ns1:.
Please help me to make my request into the required format.
I don't know much about the SOAP and I'm using PHP version 5.3.13 with CakePHP 2.3.0. Sorry, for my bad English.
Here is the solution. :)
<?php
$url = 'http://example.com/sampleapi/test.asmx?WSDL';
$client = new SoapClient($url, array("soap_version" => SOAP_1_1,"trace" => 1));
$user_param = array (
'WebProviderLoginId' => "test",
'WebProviderPassword' => "test",
'IsAgent' => false
);
$service_param = array (
'objSecurity' => $user_param,
"OutPut" => NULL,
"ErrorMsg" => NULL
);
print_r(
$client->__soapCall(
"Login",
array($service_param)
)
);
echo $client->__getLastRequest();
?>
& the request was:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/Example/Service1">
<SOAP-ENV:Body>
<ns1:Login>
<ns1:objSecurity>
<ns1:WebProviderLoginId>test</ns1:WebProviderLoginId>
<ns1:WebProviderPassword>test</ns1:WebProviderPassword>
<ns1:IsAgent>false</ns1:IsAgent>
</ns1:objSecurity>
</ns1:Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Thanks to this link.
PHP SOAP Request not right