View Single Post
  #1 (permalink)  
Old October 28th, 2006, 07:29 AM
Koushik Koushik is offline
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Consuming Axis Web Service from .NET - Problem

Hi
I have a web service hosted in WSAD developed in JAVA working on Axis 1.x platform. This web service receives an XML input and returns an XML output. I am trying to consume the web service from a .NET client.
I tried to create the proxy class to invoke the web service referred to by above WSDL by using the wsdl.exe utility of .NET.

I have written a seperate piece of code to invoke this proxy class and to invoke the web service in turn.
 Now, when I am invoking the web service from the caller class, I am passing the XML, but the return object is NULL. On inspection of the actual input to the web service, I found that the XML being passed to web service as SOAP body is getting distorted. The < of XML is getting converted to "&lt;" and the > is getting converted to "&gt;". I am not able to figure out what the problem is. However, the angular brackets in the SOAP header is remaining intact and correct.

Can anyone please help?
Also, the return from the web service being caught in the caller class is getting NULL.


=============WSDL================================= ================================================== ======================
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService" xmlns:intf="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService" xmlns:tns1="http://webservice.check.status.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema targetNamespace="http://webservice.check.status.com" xmlns="http://www.w3.org/2001/XMLSchema">
  </schema>
  <schema targetNamespace="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="getStatusReturn" type="xsd:anyType"/>
  </schema>
 </wsdl:types>

   <wsdl:message name="getStatusRequest">

      <wsdl:part element="InputCriteria" name="part"/>

   </wsdl:message>

   <wsdl:message name="getStatusResponse">

      <wsdl:part element="impl:getStatusReturn" name="getStatusReturn"/>

   </wsdl:message>

   <wsdl:portType name="VerifyStatusService">

      <wsdl:operation name="getStatus">

         <wsdl:input message="impl:getStatusRequest" name="getStatusRequest"/>

         <wsdl:output message="impl:getStatusResponse" name="getStatusResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="VerifyStatusServiceSoapBinding" type="impl:VerifyStatusService">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getStatus">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getStatusRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getStatusResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="VerifyStatusServiceService">

      <wsdl:port binding="impl:VerifyStatusServiceSoapBinding" name="VerifyStatusService">

         <wsdlsoap:address location="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
===========================END OF WEB SERVICE=========================================== ===================================


=======================PROXY CLASS DEFINITION======================================== ======================================

'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by wsdl, Version=2.0.50727.42.
'

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("w sdl", "2.0.50727.42"), _
 System.Diagnostics.DebuggerStepThroughAttribute(), _
 System.ComponentModel.DesignerCategoryAttribute("c ode"), _
 System.Web.Services.WebServiceBindingAttribute(Nam e:="VerifyStatusServiceSoapBinding", [Namespace]:="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService")> _
Partial Public Class VerifyStatusServiceService
    Inherits System.Web.Services.Protocols.SoapHttpClientProtoc ol

    Private getStatusOperationCompleted As System.Threading.SendOrPostCallback

    '''<remarks/>
    Public Sub New()
        MyBase.New
        Me.Url = "http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService"

    End Sub

    '''<remarks/>
    Public Event getStatusCompleted As getStatusCompletedEventHandler

    '''<remarks/>
    <System.Web.Services.Protocols.SoapDocumentMethodA ttribute("", Use:=System.Web.Services.Description.SoapBindingUs e.Literal, ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Bare)> _
      Public Function getStatus(<System.Xml.Serialization.XmlElementAttr ibute("getStatus", [Namespace]:="http://webservice.check.status.com")> ByVal getStatus1 As Object) As <System.Xml.Serialization.XmlElementAttribute("get StatusReturn", [Namespace]:="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService")> Object
        Dim results() As Object = Me.Invoke("getStatus", New Object() {getStatus1})
        Return CType(results(0), Object)
    End Function

    '''<remarks/>
    Public Function BegingetStatus(ByVal getStatus1 As Object, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
        Return Me.BeginInvoke("getStatus", New Object() {getStatus1}, callback, asyncState)
    End Function

    '''<remarks/>
    Public Function EndgetStatus(ByVal asyncResult As System.IAsyncResult) As Object
        Dim results() As Object = Me.EndInvoke(asyncResult)
        Return CType(results(0),Object)
    End Function

    '''<remarks/>
    Public Overloads Sub getStatusAsync(ByVal getStatus1 As Object)
        Me.getStatusAsync(getStatus1, Nothing)
    End Sub

    '''<remarks/>
    Public Overloads Sub getStatusAsync(ByVal getStatus1 As Object, ByVal userState As Object)
        If (Me.getStatusOperationCompleted Is Nothing) Then
            Me.getStatusOperationCompleted = AddressOf Me.OngetStatusOperationCompleted
        End If
        Me.InvokeAsync("getStatus", New Object() {getStatus1}, Me.getStatusOperationCompleted, userState)
    End Sub

    Private Sub OngetStatusOperationCompleted(ByVal arg As Object)
        If (Not (Me.getStatusCompletedEvent) Is Nothing) Then
            Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEvent Args = CType(arg,System.Web.Services.Protocols.InvokeComp letedEventArgs)
            RaiseEvent getStatusCompleted(Me, New getStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
        End If
    End Sub

    '''<remarks/>
    Public Shadows Sub CancelAsync(ByVal userState As Object)
        MyBase.CancelAsync(userState)
    End Sub
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("w sdl", "2.0.50727.42")> _
Public Delegate Sub getStatusCompletedEventHandler(ByVal sender As Object, ByVal e As getStatusCompletedEventArgs)

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("w sdl", "2.0.50727.42"), _
 System.Diagnostics.DebuggerStepThroughAttribute(), _
 System.ComponentModel.DesignerCategoryAttribute("c ode")> _
Partial Public Class getStatusCompletedEventArgs
    Inherits System.ComponentModel.AsyncCompletedEventArgs

    Private results() As Object

    Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object)
        MyBase.New(exception, cancelled, userState)
        Me.results = results
    End Sub

    '''<remarks/>
    Public ReadOnly Property Result() As Object
        Get
            Me.RaiseExceptionIfNecessary
            Return CType(Me.results(0),Object)
        End Get
    End Property
End Class

=========================================END OF PROXY CLASS DEFINITION======================================== ==========


=====================================CODE FOR INVOKING METHOD============================================ ================
'Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Xml.Serialization
'Imports System.Runtime.Serialization.Formatters.Soap
Imports System.IO
Imports System.Text
Imports System



Public Class Console
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(184, 88)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(88, 40)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        '
        'Console
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Console"
        Me.Text = "Console"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try

            Dim ghij As New System.Xml.XmlDocument
            ghij.Load("C:\Koushik\CREST\Work\NIVR2\INPUT\PFSte st-INP-AAF67-000000001591.xml")



             Dim myobj As New PFSAgentLoanStatusServiceService


            a = myobj.getAgentLoanStatus(ghij.OuterXml)
          Catch ex As Exception
            MsgBox(ex.ToString)
            MsgBox(ex.StackTrace)
        End Try

    End Sub
End Class



Reply With Quote