I’m having trouble finding some node on WSDL (XML) document with DOMDocument PHP. When I use getElementsByTagName it always return NULL. what I’m about to find is xsd:complexType but when I try different node, let say types, it’s return a object.
This is my WSDL (XML) Document
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:routeDx2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:routeDx2">
<types>
<xsd:schema targetNamespace="urn:routeDx2"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="inputCashin">
<xsd:all>
<xsd:element name="userName" type="xsd:string"/>
<xsd:element name="signature" type="xsd:string"/>
<xsd:element name="productCode" type="xsd:string"/>
<xsd:element name="merchantCode" type="xsd:string"/>
<xsd:element name="terminal" type="xsd:string"/>
<xsd:element name="merchantNumber" type="xsd:string"/>
<xsd:element name="transactionType" type="xsd:string"/>
<xsd:element name="recipientNumber" type="xsd:string"/>
<xsd:element name="recipientName" type="xsd:string"/>
<xsd:element name="amount" type="xsd:string"/>
<xsd:element name="feeAmount" type="xsd:string"/>
<xsd:element name="traxId" type="xsd:string"/>
<xsd:element name="timeStamp" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="inputCashout">
<xsd:all>
<xsd:element name="userName" type="xsd:string"/>
<xsd:element name="signature" type="xsd:string"/>
<xsd:element name="productCode" type="xsd:string"/>
<xsd:element name="merchantCode" type="xsd:string"/>
<xsd:element name="terminal" type="xsd:string"/>
<xsd:element name="merchantNumber" type="xsd:string"/>
<xsd:element name="transactionType" type="xsd:string"/>
<xsd:element name="recipientNumber" type="xsd:string"/>
<xsd:element name="recipientName" type="xsd:string"/>
<xsd:element name="amount" type="xsd:string"/>
<xsd:element name="feeAmount" type="xsd:string"/>
<xsd:element name="verifyingCode" type="xsd:string"/>
<xsd:element name="traxId" type="xsd:string"/>
<xsd:element name="timeStamp" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<definitions>
what I’m about to find is xsd:complexType or if that’s possible, how to find by attribute name that has unique value (verifyingCode or else), how do I accomplish this via PHP and DOMDocument?
Besides your incorrect closing tag for
<definitions>(last line), I don’t see a problem.Demo – http://codepad.viper-7.com/95XDsS
You’re probably including the
xsdnamespace in your tag name query. If you read the docs, you will see the argument togetElementsByTagName()specifies