2

I am writing a php script to call a soap webservice written in java.Before this I used to call service using soap UI with xml request and it used to work.but when I am trying to invoke service from php it is throwing error as it is not able to convert the request to proper java object.The xml request is :

<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http:///services/common/commondf/v3/" xmlns:inp="http://..confidential.../input/">
   <soapenv:Header>
      <v3:Info>
         <requestId>Sample</requestId>
      </v3:Info>
   </soapenv:Header>
   <soapenv:Body>
      <m:Input xmlns:m="http://../conf/ident/ial/../input/">
         <a>
            <b>
               <scheme>123</scheme>
               <value>aaa</value>
            </b>
            <c>
               <date>2018-04-09</date>
               <e>
                  <scheme>1234</scheme>
                  <value>bbb</value>
               </e>
            </c>
            <f>
               <scheme>seniority type</scheme>
               <value>ccccccct</value>
            </f>
            <g>....
...........................
.........................
      </m:Input>
   </soapenv:Body>
</soapenv:Envelope>

xml is too big and complex so I cant keep converting it xml array object by object. what i used is simple_xml_load_string as below:

$xml= file_get_contents('test.xml');
$xml_array =  simplexml_load_string($xml);
$array = json_decode(json_encode($xml), true);
try {           
$wsdl='http://localhost/service?wsdl';      
require_once('nusoap.php');
$endpoint = "http://localhost/service";

$mynamespace = "http://something/input/";
$client = new nusoap_client($endpoint);
$err = $client->getError();
if ($err) 
{
   echo  $err;
}
$response = $client->call('Input', $array , $mynamespace);
print_r($response);
}catch(Exception $e){
    var_dump($e->getMessage());
}

when i hit this the error I get is

Array ( [faultcode] => soap:Client [faultstring] => Problems creating SAAJ object model )

In my soap application the calling function is defined as follows:

java method:
    public output inputDetails(Input input) throws someException 
    {
            ----logic-----
    }

so basically what I feel is 'input' object is not passed in the method properly, that means some problem in php array $array.How to convert the complex xml used in soap ui to php array so that it properly converts into java object.. or someother problem? Can anyone please help.

Harsha
  • 87
  • 1
  • 14

0 Answers0