B4J Question [Resolved]ResponseError. Reason: Internal Server Error SOAP

Similar threads

B4J Question Internal Server Error
B4J Question B4J Soap error
B4J Question Reading value from XML
B4J Question Help with SOAP error
B4J Question Help with SOAP in B4J

Johan Hormaza

Well-Known Member
Licensed User
I can not get any response to this example.
I only receive a strange error.

B4X:
Dim xml As String =  $"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ProcessCardPayment xmlns="https://pagosinteligentes.com/">
      <PaymentOption>int</PaymentOption>
      <AcID>long</AcID>
      <Ref1>string</Ref1>
      <Ref2>string</Ref2>
      <Ref3>string</Ref3>
      <Amount>long</Amount>
      <Tax>long</Tax>
      <BDev>long</BDev>
      <Description>string</Description>
      <BankName>string</BankName>
      <CardNumber>string</CardNumber>
      <CVV2>string</CVV2>
      <CardFranchise>string</CardFranchise>
      <Fees>long</Fees>
      <ExpDate>string</ExpDate>
      <AccountType>int</AccountType>
      <IdType>string</IdType>
      <IdNumber>string</IdNumber>
      <FName>string</FName>
      <LName>string</LName>
      <Mobile>string</Mobile>
      <Phone>string</Phone>
      <Email>string</Email>
      <Region>string</Region>
      <City>string</City>
      <Address>string</Address>
      <Country>string</Country>
      <AccountPassword>string</AccountPassword>
    </ProcessCardPayment>
  </soap:Body>
</soap:Envelope>"$
    Dim j As HttpJob
    j.Initialize("", Me)
    j.PostString("https://dev.pagosinteligentes.com/webservices/mainwebservicesV2.asmx", xml)
    j.GetRequest.SetContentType("text/xml")
    j.GetRequest.SetHeader("SOAPAction", $""https://pagosinteligentes.com/ProcessCardPayment""$)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
 

Johan Hormaza

Well-Known Member
Licensed User
Replace the values as well?

B4X:
Dim xml As String =  $"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <ProcessCardPayment xmlns="https://dev.pagosinteligentes.com">
    <PaymentOption>$Xml{PaymentOption}</PaymentOption>
    <AcID>$Xml{edtAcID.Text}</AcID>
    <Ref1>$Xml{edtReferencia1.Text}</Ref1>
    <Ref2>$Xml{edtReferencia2.Text}</Ref2>
    <Ref3>$Xml{edtReferencia3.Text}</Ref3>
    <Amount>$Xml{edtAmount.Text}</Amount>
    <Tax>$Xml{edtTax.Text}</Tax>
    <BDev>$Xml{edtBDev.Text}</BDev>
    <Description>$Xml{edtDescription.Text}</Description>
    <BankName>$Xml{edtBankName.Text}</BankName>
    <CardNumber>$Xml{edtCardNumber.Text}</CardNumber>
    <CVV2>$Xml{edtCVV2.Text}</CVV2>
    <CardFranchise>$Xml{CardFranchise}</CardFranchise>
    <Fees>$Xml{edtFees.Text}</Fees>
    <ExpDate>$Xml{edtExpDate.Text}</ExpDate>
    <AccountType>$Xml{AccountType}</AccountType>
    <IdType>$Xml{IdType}</IdType>
    <IdNumber>$Xml{edtIdNumber.Text}</IdNumber>
    <FName>$Xml{edtFName.Text}</FName>
    <LName>$Xml{edtLName.Text}</LName>
    <Mobile>$Xml{edtMobile.Text}</Mobile>
    <Phone>$Xml{edtPhone.Text}</Phone>
    <Email>$Xml{edtEmail.Text}</Email>
    <Region>$Xml{edtRegion.Text}</Region>
    <City>$Xml{edtCity.Text}</City>
    <Address>$Xml{edtAddress.Text}</Address>
    <Country>$Xml{edtCountry.Text}</Country>
    <AccountPassword>$Xml{edtAccountPassword.Text}</AccountPassword>
    </ProcessCardPayment>
    </soap:Body>
    </soap:Envelope>"$
    Dim j As HttpJob
    j.Initialize("", Me)
    j.PostString("https://dev.pagosinteligentes.com/webservices/mainwebservicesV2.asmx", xml)
    j.GetRequest.SetContentType("text/xml")
    j.GetRequest.SetHeader("SOAPAction", $""https://pagosinteligentes.com/ProcessCardPayment""$)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
 

DonManfred

Expert
Licensed User
Start with using YOUR DATA. What exactly do you want to send here? The content of the editfields?
Help us help you; give us more informations.

Edit: Ahh, i see. The value are automatically escaped using the Xml keyword...

start with logging the generated xml string. Does it look correct?
 
Last edited:

Johan Hormaza

Well-Known Member
Licensed User
I guess you dont need to escape int and long values... the api is expecting a number here.
with $Xml{yournumber} an the number 8 you add '8' instead of 8 maybe? You ned to log to know what you are sending.

I would not use $Xml with numbers.
Nothing that works, I do everything you tell me and I always have this error:
upload_2019-7-21_11-0-23.png
 

DonManfred

Expert
Licensed User
Hard to help you. I never asked to log the response. I asked you to log the xml generated and which you are sending to check if they look good.

Try to send the same xml using some other software. postman of whatever. Does it work?

The response does not look as json or xml at all. Looks kind of binary to me.
 

Johan Hormaza

Well-Known Member
Licensed User
Ok, I already solved the problem.
It was the servant who generated the error.
By the way, @DonManfred , the problem was that you should not put the '$ XML' as you said.
Thank you!
 
Top