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

Discussion in 'B4J Questions' started by Johan Hormaza, Jul 20, 2019.

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 Posible BUG in B4J with poststring
  1. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    I can not get any response to this example.
    I only receive a strange error.

    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Johan Hormaza likes this.
  3. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Excuse EREL what do you mean automatically?
    Thank you
     
  4. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Replace the values as well?

    Code:
    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
     
  5. DonManfred

    DonManfred Expert Licensed User

    what does
    Code:
    $Xml{edtFees.Text}
    output here? Are ou sure it is a valid value?
    Do you meant to use
    Code:
    ${edtFees.Text}
    without the Xml keyword (whatever this means)
     
    Johan Hormaza likes this.
  6. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    In the video tutorial of WEB SERVICE that EREL dictates, he places that expression
     
  7. DonManfred

    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: Jul 21, 2019
    Erel likes this.
  8. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Yes
     
  9. DonManfred

    DonManfred Expert 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.
     
  10. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Nothing that works, I do everything you tell me and I always have this error:
    upload_2019-7-21_11-0-23.png
     
  11. DonManfred

    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.
     
  12. Johan Hormaza

    Johan Hormaza Active 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!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice