How to call Java Web Service through .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wes1983
    New Member
    • May 2010
    • 1

    How to call Java Web Service through .net

    I had deploy a program to call Java Web services from VB.net . Below is my code:

    Code:
           Dim myGetCustInfoNewService As GetCustInfoNewService.SA1Z1003 = New GetCustInfoNewService.SA1Z1003()
    
    
                Dim a As Integer = myCalculatorService.Add(6, 2)
    
                '---------------------Define Input Parameter----------------------------
                strTransNo = Date.Today.Year.ToString.PadLeft(4, CChar("0")) & _
                                Date.Now.Month.ToString.PadLeft(2, CChar("0")) & _
                                Date.Now.Day.ToString.PadLeft(2, CChar("0")) & _
                                Date.Now.Hour.ToString.PadLeft(2, CChar("0")) & _
                                Date.Now.Minute.ToString.PadLeft(2, CChar("0")) & _
                                Date.Now.Second.ToString.PadLeft(5, CChar("0")) & _
                                Date.Now.Millisecond.ToString.PadLeft(6, CChar("0"))
    
    
            
                Dim myInstanceGetCustInfoNewServiceRequest As GetCustInfoNewService.SA1Z1004 = New GetCustInfoNewService.SA1Z1004()
                myInstanceGetCustInfoNewServiceRequest.TransNo = strTransNo
                myInstanceGetCustInfoNewServiceRequest.TypOpt = strTypOpt
                myInstanceGetCustInfoNewServiceRequest.OptInp = strOptInp
    
                'Dim strAbc As String()
                'strAbc = myGetCustInfoNewService.SA1Z1004(myInstanceGetCustInfoNewServiceRequest)
    
    
               
                Dim myKey
                myKey = " <SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/""" & _
                        " xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/""" & _
                       " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""" & _
                        " xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> " & _
                        " <SOAP-ENV:Body> " & _
                        " <SA1Z1003 xmlns=""http://TestWeb/cics/esp1/dfhwsdsh/espick""> " & _
                            " <SA1Z1003>" & _
                                "<TransNo>" & strTransNo & "</TransNo> " & _
                                "<TypOpt>" & strTypOpt & "</TypOpt> " & _
                               "<OptInp>" & strPVaccNo & "</OptInp> " & _
                            " <SA1Z1003>" & _
                        "</SA1Z1003> " & _
                        "</SOAP-ENV:Body> " & _
                        "</SOAP-ENV:Envelope> "
    
              
                Dim soap As Object
                soap = Server.CreateObject("MSXML2.ServerXMLHTTP")
                soap.open("post", "http://TestWeb/cics/esp1/dfhwsdsh/esp", False)
                soap.setRequestHeader("Content-Type", "text/xml")
                soap.setRequestHeader("soapAction", "http://TestWeb/cics/esp1/dfhwsdsh/esp/SA1Z1004")
                soap.send(myKey)
    
                If soap.status = 200 Then
                    Dim Res1 As Object
                    Res1 = Server.CreateObject("MSXML2.DOMDocument")
                    Res1.loadXML(soap.responseText)
                    Res1.save("c:\sucess.xml")
    
                Else
                    Dim Res2 As Object
                    Res2 = Server.CreateObject("MSXML2.DOMDocument")
                    Res2.loadXML(soap.responseText)
                    Res2.save("c:\error.xml")
                End If

    after run the code, I had get soap error code 500 after soap.send(), is that anything wrong with my program ??
    Last edited by tlhintoq; May 2 '10, 05:59 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you first created your question you were asked to wrap your code with [code] tags.
    [imgnothumb]http://files.me.com/tlhintoq/10jihf[/imgnothumb]
    It really does help a bunch. Look how much easier it is to read now that someone has done it for you. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      500 Error means that the server encountered an unexpected condition which prevented it from fulfilling the request.

      Check the server for the reason...

      Comment

      Working...