B4J Question Help with SOAP in B4J

Discussion in 'B4J Questions' started by aaronk, Jun 16, 2015.

  1. aaronk

    aaronk Well-Known Member Licensed User

    Hi,

    I am having a issue trying to send a SOAP request.
    I am using a Non-UI Application.

    I can't say I have ever done SOAP messages/requests before so I am learning as I work on this.

    The following is the code I am using:
    (I removed the IP from the code I posted)

    Code:
    'Non-UI application (console / server application)
    #Region  Project Attributes
        
    #CommandLineArgs:
        
    #MergeLibraries: True
    #End Region

    Sub Process_Globals
       
    End Sub

    Sub AppStart (Args() As String)

        
    Dim job1 As HttpJob
           
    Dim requestSoapXML As String

           requestSoapXML = 
    "<?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:Header>" & _
                        
    "    <CredentialsHeader xmlns='https://xxx.xxx.xxx.xxx/test/API'>" & _
                        
    "      <OrganizationID>1234</OrganizationID>" & _
                        
    "      <Username>Admin</Username>" & _
                        
    "      <Password>1234</Password>" & _
                        
    "    </CredentialsHeader>" & _
                        
    "  </soap:Header>" & _
                        
    "  <soap:Body>" & _
                        
    "    <ListAccounts xmlns='https://xxx.xxx.xxx.xxx/test/API' />" & _
                        
    "  </soap:Body>" & _
                        
    "</soap:Envelope>"
       

          job1.Initialize(
    "JOB1", Me)
           job1.PostString(
    "https://xxx.xxx.xxx.xxx/Accounts.asmx", requestSoapXML)

        StartMessageLoop
       
    End Sub

    Public Sub JobDone (Job As HttpJob)
        
    If Job.Success = True Then
            
    Log(Job.GetString)
        
    End If
       Job.Release
    End Sub
    The error I am getting is:

    I guess I am doing something wrong..

    Anyone know what I have done wrong ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. aaronk

    aaronk Well-Known Member Licensed User

    Thanks for the reply.
    Didn't realise that I needed to use those 2 modules rather than the library that I was using.

    When I use it I am getting this error:

    Any ideas on what is causing this to happen ?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This means that the SSL certificate is not recognized.
     
  5. aaronk

    aaronk Well-Known Member Licensed User

    Any idea on how to make it so that it is recognized ?

    Is this a SSL certificate error or just that B4J (Java) doesn't like the certificate that it received ?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Is this a self signed certificate? You can modify HttpUtils2 and change hc.Initialize to hc.InitializeAcceptAll.
     
    hibrid0 likes this.
  7. aaronk

    aaronk Well-Known Member Licensed User

Loading...