Good day Guys!
Just want to ask. Im using a wsdl generated from php. Using httpjob, i am trying to post a request to the file and receive an xml response. The problem is, the response is the xml code of the wsdl file. Can someone direct me to the right path? I am trying to call the login function
wsdl file: (sample)
code:
i have already done this using actual php code and .net asmx, i was able to get the result but im kind of confuse how i can execute it using wsdl
Just want to ask. Im using a wsdl generated from php. Using httpjob, i am trying to post a request to the file and receive an xml response. The problem is, the response is the xml code of the wsdl file. Can someone direct me to the right path? I am trying to call the login function
wsdl file: (sample)
B4X:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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:coreon.gcash" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:coreon.gcash">
<types>
<xsd:schema targetNamespace="urn:coreon.gcash">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="resultInfo">
<xsd:all>
<xsd:element name="result" type="xsd:string"/>
<xsd:element name="transid" type="xsd:string"/>
<xsd:element name="msg" type="xsd:string"/>
<xsd:element name="session" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="loginRequest">
<part name="id" type="xsd:string" />
<part name="password" type="xsd:string" /></message>
<message name="loginResponse">
<part name="return" type="xsd:resultInfo" /></message>
<portType name="coreon.gcashPortType">
<operation name="login">
<documentation>User Login</documentation>
<input message="tns:loginRequest"/>
<output message="tns:loginResponse"/>
</operation>
</portType>
<binding name="coreon.gcashBinding" type="tns:coreon.gcashPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="login">
<soap:operation soapAction="uri:coreon.gcash#login" style="rpc"/>
<input><soap:body use="encoded" namespace="uri:coreon.gcash" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="uri:coreon.gcash" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
code:
B4X:
Sub consumeService(strOpt As String,data1 As String,data2 As String,data3 As String,data4 As String,data5 As String,data6 As String,data7 As String,data8 As String)
Dim PostUrl As String = ""
Dim strXML As String=""
Dim job1 As HttpJob
Select Case strOpt
Case "1" 'Login
PostUrl = "http://xxxx.5.xxx.xxx/coreonCash_dev4/pages/Coreon_GCash.wsdl"
strXML = "<?xml version='1.0' encoding='UTF-8'?>"
strXML = strXML & "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' "
strXML = strXML & "xmlns:ns1='uri:coreon.gcash' xmlns:xsd='http://www.w3.org/2001/XMLSchema' "
strXML = strXML & "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' "
strXML = strXML & "SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>"
strXML = strXML & "<SOAP-ENV:Body>"
strXML = strXML & "<ns1:loginRequest>"
strXML = strXML & "<id xsi:type='xsd:String'>" & data1 & "</id>"
strXML = strXML & "<password xsi:type='xsd:String'>" & data2 & "</password>"
strXML = strXML & "</ns1:login>"
strXML = strXML & "</SOAP-ENV:Body>"
strXML = strXML & "</SOAP-ENV:Envelope>"
strXML = strXML.Replace("'", Chr(34))
job1.Initialize("login", Me)
job1.PostString(PostUrl, strXML)
job1.GetRequest.SetContentType("text/xml; charset=utf-8")
End Select
End Sub
Sub JobDone (Job As HttpJob)
If Job.Success Then
Select Job.JobName
Case "login"
Log(Job.GetString)
parser.Initialize()
parser.Parse(Job.GetInputStream , "Parser")
End Select
Else
Msgbox( "Error in Accessing Web Portal," & CRLF & "Make sure you are connected to the Internet!", "Error")
'Msgbox( Job.errormessage , "Error")
End If
Job.Release
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If parser.Parents.IndexOf("login") > -1 Then 'login
If Name = "session" Then
strSession = Text.ToString
Else If Name = "result" Then
strResult = Text.ToString
End If
End If
End Sub
i have already done this using actual php code and .net asmx, i was able to get the result but im kind of confuse how i can execute it using wsdl