I have a web-service with following link
I'm trying to access the function name with SubmitRequestType
but it seems the function is not exist instead submitAnsiSingle
this is the correct function name what I tried so far is ,
$wsdl = 'https://ww3.navicure.com:7000/webservices/NavicureSubmissionService?WSDL';
class SecurityHeaderType {
private $submitterIdentifier;
private $originatingIdentifier;
private $submitterPassword;
private $submissionId;
function SecurityHeaderType() {
$this->submitterIdentifier = '***';
$this->originatingIdentifier = '****';
$this->submitterPassword = '****';
$this->submissionId = '';
}
}
class SubmitRequestType {
private $submitterIdentifier;
private $originatingIdentifier;
private $submitterPassword;
private $submissionId;
private $timeout;
private $transactionType;
private $submittedAnsiVersion;
private $resultAnsiVersion;
private $submitterSubmissionId;
private $processingOption;
private $payload;
private $exceptions;
function SubmitRequestType() {
$this->submitterIdentifier = '***';
$this->originatingIdentifier = '***';
$this->submitterPassword = '**';
$this->submissionId = '**';
$this->timeout = 60 ;
$this->transactionType = "E";
$this->submittedAnsiVersion = '5010';
$this->resultAnsiVersion = '5010';
$this->submitterSubmissionId = '**';
$this->processingOption = 'R';
$this->payload = 'EDI-270-Request';
$this->exceptions = true;
}
}
$soapheader = new SecurityHeaderType();
$submitrequest = new SubmitRequestType();
$service = new \SoapClient($wsdl);
$result= $service->SubmitAnsiSingle($submitrequest);
echo "<pre/>";print_r($result);
$types = $service->__getTypes ();
$functions = $service->__getFunctions ();
//echo "<pre/>";print_r($types);
//echo "<pre/>";print_r($functions);
But I'm getting the response like below it seems the request is processing on their end but the SecurityHeaderType
is not parsing their end.
stdClass Object
(
[transactionTyp] => E
[submitterSubmissionId] => ****
[submittedAnsiVersion] => 5010
[resultAnsiVersion] => 5010
[statusHeader] => stdClass Object
(
[statusCode] => 1150
[statusMessage] => com.navicure.webservices.core.WSCoreException: Account does not exist for ''
[requestProcessed] =>
)
)
Any hint will be highly appreciate
Thanks in advance.
I found the solution!. It seems the PHP -> .NET web service comparability issue. So from PHP the complex type SOAP (this kind of format) can't access I found some usefull post here. So I switched SOAP to plain XML request with CURL and it seems working fine!. Also from WSDL link we can extract the request template using this online service . So my final code look like below.
$xml_data = "<?xml version='1.0' encoding='UTF-8'?>
<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'>
<s12:Header>
<ns1:SecurityHeaderElement xmlns:ns1='http://www.navicure.com/2009/11/NavicureSubmissionService'>
<ns1:originatingIdentifier>****</ns1:originatingIdentifier>
<ns1:submitterIdentifier>****</ns1:submitterIdentifier>
<ns1:submitterPassword>***</ns1:submitterPassword>
<ns1:submissionId>?999?</ns1:submissionId>
</ns1:SecurityHeaderElement>
</s12:Header>
<s12:Body>
<ns1:SubmitAnsiSingleRequestElement xmlns:ns1='http://www.navicure.com/2009/11/NavicureSubmissionService'>
<ns1:timeout>60</ns1:timeout>
<ns1:transactionType>E</ns1:transactionType>
<ns1:submittedAnsiVersion>5010</ns1:submittedAnsiVersion>
<ns1:resultAnsiVersion>5010</ns1:resultAnsiVersion>
<ns1:submitterSubmissionId></ns1:submitterSubmissionId>
<ns1:processingOption>R</ns1:processingOption>
<ns1:payload>EDI270Payload</ns1:payload>
</ns1:SubmitAnsiSingleRequestElement>
</s12:Body>
</s12:Envelope>";
$URL = "https://ww3.navicure.com:7000/webservices/NavicureSubmissionService";
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
Hope this will help someone else in future.
You might be running into PHP's slightly less than compatible WSDL2 implementation. You could try the following and cross your fingers;
Headerbody needs to be implemented in the same depth as defined in xml, since I do not have access to navicure's documentation here's example code:
$headerbody = array('Token' => $someToken,
'Version' => $someVersion,
'UserCredentials'=>array('UserID'=>$UserID,
'Password'=>$Pwd));
//Create Soap Header.
$header = new SOAPHeader($namespace, 'RequestorCredentials', $headerbody);
// In case multiple headers are required, create $headers[] = $header, and append to headers after.
$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
try {
$soap = new SoapClient($wsdl, $options);
$soap->__setSoapHeaders($header);
$data = $soap->SubmitAnsiSingle(array($submitrequest));
}
catch(Exception $e) {
die($e->getMessage());
}
Hope this is of any use - in case WSDL2 is actually used you might be able to get it to work with nusoap which can be found on sourceforge. Although that hasn't been updated in quite a while..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With