4DSOAP in PHP

I came accross problem with 4D SOAP request while i was working on web service.Normally webservice have only .wsdl file and PHP function can take care of rest of things but in my case, my client have webservice in 4D server another third party website who handle their database as well as web service.

4d server,a fourth-generation language with over 1000 high-level commands, a built-in HTTP server, application server, etc.It handle ANSI SQL relational and transcation database.After gone throught all documents,we concluded that 4D soap is much easier to integrate than 4D database because 4D database need PHP driver(PDO_4D) to handle PHP data objects.

Lets start with steps to handle 4D SOAP :-

1. In my case, my Client using firewall to block IPs address,they have suggested to open their firewall for our specific IP addresses because they didnt want to ping any person in their web service and get result.

2.Start to donwload SoapUI tool to test your webservice.Here is link to download http://sourceforge.net/projects/soapui/

3.4DSOAP has basically two methods SoapServicesTxt and SoapServicesBlob.These method has written from 4D server.Basically you have to pass all parameters and call function.There is no such rule you can only pass single parameter and get result.

4.Let start with PHP,I am using Nusoap class to call 4DSOAP server.Nusoap is having sample examples where you can see where is your request is going by nusoap parser.if any fault occure,its will tell you where soap fault occure during transftering request.

5. 4DSOAP request



       <?xml version="1.0" encoding="ISO-8859-1"?>
        <RequestedMethodWrapper>
        <RequestedMethodParams>
        <MbrxSoapLicenseNo>MBR3853850</MbrxSoapLicenseNo>
        <DataReturnFormat>XML</DataReturnFormat>
        <ServerDebugLog>Off</ServerDebugLog>
       <RequestedMethod>CompanyList3</RequestedMethod>
       <CompanyForOrgID>All</CompanyForOrgID>
       <MemberShipStatus>CurrentMembersOnly</MemberShipStatus>
       </RequestedMethodParams>
       </RequestedMethodWrapper>

5. My PHP code look like below

require_once('../lib/nusoap.php');
$client = new nusoap_client('http://173.299.294.241:8080/4DSOAP/');
$XMLstring='<?xml version="1.0" encoding="ISO-8859-1"?>
<RequestedMethodWrapper>
<RequestedMethodParams>
<MbrxSoapLicenseNo>MBR3853850</MbrxSoapLicenseNo>
<DataReturnFormat>XML</DataReturnFormat>
<ServerDebugLog>Off</ServerDebugLog>
<RequestedMethod>CompanyList3</RequestedMethod>
<CompanyForOrgID>All</CompanyForOrgID>
<MemberShipStatus>CurrentMembersOnly</MemberShipStatus>
</RequestedMethodParams>
</RequestedMethodWrapper>';
$result = $client->call('SoapServicesBlob', $XMLstring);
$responseXML = simplexml_load_string($result);
print_r($result);

Note: I am passing string as input in my 4DSOAP and return back in response as a string.Try to leave HTML entity Name as string don’t convert into Symbol of HTML entity..

This entry was posted in Web Service. Bookmark the permalink.