PHP Web Service: nusoap

Keys to access .Net web service:

  1. Datetime formate: 1961-12-21T00:00:00
  2. If passing a null parameter, "xsi:nil=true" attribute must be added. e.g. <deduct xsi:nil="true" />
  3. Use "soapval" to add data type attributes of a parameter.
    e.g. 'assuredBirth' => new soapval('assuredBirth', 'dateTime', '1961-12-21T00:00:00', false, 'http://www.w3.org/2001/XMLSchema')
  4. Null DateTime: 0001-01-01T00:00:00
  5. Conclusion: .Net web services don't like nusoap!! Try to use native soap functions of PHP.
    http://tw1.php.net/soap
     

Useful tool to test web services:

  1. wizdl: Amazing tool to test .Net web services:
    http://wizdl.codeplex.com/
  2. SOAP Client:
    http://www.soapclient.com/soapclient

Web Service Example:

Reference:

Tools:

Complete successful SOAP request:

<?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>
		<WebQuatation xmlns="http://ws.vehicle.tfmi.com/">
			<wsTradeTO>
				<plyInsTypeTOs>
					<PlyInsTypeTO>
						<isSkipCalculate>false</isSkipCalculate>
						<insType>210</insType>
						<chDamageCover xsi:nil="true" />
						<chDeathCover xsi:nil="true" />
						<chInjuredCover xsi:nil="true" />
						<cmnNt xsi:nil="true" />
						<commission xsi:nil="true" />
						<commissionRate xsi:nil="true" />
						<damageCover>2000000</damageCover>
						<deathCover>2000000</deathCover>
						<deduct xsi:nil="true" />
						<discount>0</discount>
						<discountRate xsi:nil="true" />
						<drate>0001-01-01T00:00:00</drate>
						<injuredCover>200000</injuredCover>
						<prem xsi:nil="true" />
						<premiumMan xsi:nil="true" />
						<premium xsi:nil="true" />
						<srvFee xsi:nil="true" />
						<baseDangerPrem xsi:nil="true" />
						<stDangerPrem xsi:nil="true" />
						<stDangerRate xsi:nil="true" />
						<thisPremium xsi:nil="true" />
						<prePremium xsi:nil="true" />
						<drunkCnt xsi:nil="true" />
						<exFactor1 xsi:nil="true" />
						<exFactor2 xsi:nil="true" />
						<exFactor3 xsi:nil="true" />
					</PlyInsTypeTO>
				</plyInsTypeTOs>
				<plySubdataTOs />
				<assuredBirth>1961-12-21T00:00:00</assuredBirth>
				<applicantBirth xsi:nil="true" />
				<applyDateTime xsi:nil="true" />
				<assuredId>N222023654</assuredId>
				<assuredSex>2</assuredSex>
				<branchPassDateTime xsi:nil="true" />
				<brand>MC001000</brand>
				<brgAlign xsi:nil="true" />
				<brgFactor xsi:nil="true" />
				<broker66>99</broker66>
				<c010Clm xsi:nil="true" />
				<c010Pnt xsi:nil="true" />
				<c210NSeq xsi:nil="true" />
				<c210NSeqMan xsi:nil="true" />
				<c210OSeq xsi:nil="true" />
				<c210Prem xsi:nil="true" />
				<c210DrunkCnt xsi:nil="true" />
				<c210DrunkPrem xsi:nil="true" />
				<c310Clm xsi:nil="true" />
				<c310Grd xsi:nil="true" />
				<c310NSeq xsi:nil="true" />
				<c310OSeq xsi:nil="true" />
				<c310NSeqMan xsi:nil="true" />
				<carPrice>0</carPrice>
				<carType66>01</carType66>
				<cylinder xsi:nil="true" />
				<dmgAccFactor xsi:nil="true" />
				<dmgAcCnt1 xsi:nil="true" />
				<dmgAcCnt2 xsi:nil="true" />
				<dmgAcCnt3 xsi:nil="true" />
				<dmgAlign xsi:nil="true" />
				<dmgFactor xsi:nil="true" />
				<edrBegin60 xsi:nil="true" />
				<edrBegin66>2014-08-13T00:00:00</edrBegin66>
				<edrDate xsi:nil="true" />
				<edrEnd60 xsi:nil="true" />
				<edrEnd66>2015-08-13T00:00:00</edrEnd66>
				<edrPeriod60 xsi:nil="true" />
				<edrPeriod66 xsi:nil="true" />
				<edrPre xsi:nil="true" />
				<edrSeq xsi:nil="true" />
				<entryDate xsi:nil="true" />
				<expAlign xsi:nil="true" />
				<fpt66>P</fpt66>
				<issueYM>199707</issueYM>
				<liaAccFactor xsi:nil="true" />
				<liaAcCnt1 xsi:nil="true" />
				<liaAcCnt2 xsi:nil="true" />
				<liaAcCnt3 xsi:nil="true" />
				<liaAlign xsi:nil="true" />
				<mngAlign xsi:nil="true" />
				<officer66>1166</officer66>
				<isPublicOfficerType60>false</isPublicOfficerType60>
				<isPublicOfficerType66>false</isPublicOfficerType66>
				<isOpenCover>false</isOpenCover>
				<plyPassDateTime xsi:nil="true" />
				<proMonth>07</proMonth>
				<proYear>1997</proYear>
				<qpt60 xsi:nil="true" />
				<qpt66>2</qpt66>
				<reinsPassDateTime xsi:nil="true" />
				<savAlign xsi:nil="true" />
				<scrapValue xsi:nil="true" />
				<sexAgeFactor66 xsi:nil="true" />
				<sexAgeFactor60 xsi:nil="true" />
				<tag>GOJ-329</tag>
				<updateDateTime xsi:nil="true" />
			</wsTradeTO>
		</WebQuatation>
	</soap:Body>
</soap:Envelope>