Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 28th, 2006, 07:32 AM
Authorized User
Join Date: Oct 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling Axis Web Service from VB.NET - XML distort

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)-->
  <schema targetNamespace="http://webservice.check.status.com" xmlns="http://www.w3.org/2001/XMLSchema">
  <schema targetNamespace="http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="getStatusReturn" type="xsd:anyType"/>

   <wsdl:message name="getStatusRequest">

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


   <wsdl:message name="getStatusResponse">

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


   <wsdl:portType name="VerifyStatusService">

      <wsdl:operation name="getStatus">

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

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



   <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:output name="getStatusResponse">

            <wsdlsoap:body use="literal"/>




   <wsdl:service name="VerifyStatusServiceService">

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

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



===========================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.

<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

    Public Sub New()
        Me.Url = "http://localhost:9080/VerifyStatusWeb/webservice/VerifyStatusService"

    End Sub

    Public Event getStatusCompleted As getStatusCompletedEventHandler

    <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

    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

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

    Public Overloads Sub getStatusAsync(ByVal getStatus1 As Object)
        Me.getStatusAsync(getStatus1, Nothing)
    End Sub

    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

    Public Shadows Sub CancelAsync(ByVal userState As Object)
    End Sub
End Class

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

<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

    Public ReadOnly Property Result() As Object
            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()

        'This call is required by the Windows Form Designer.

        '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
            End If
        End If
    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.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"
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Name = "Console"
        Me.Text = "Console"

    End Sub

#End Region

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


            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
        End Try

    End Sub
End Class

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Axis web service from .NET client Koushik .NET Web Services 4 April 2nd, 2010 09:16 PM
java axis web service deb_net J2EE 2 June 12th, 2007 12:40 AM
Consuming Axis Web Service from .NET - Problem Koushik .NET Web Services 0 October 28th, 2006 07:29 AM
Calling Axis web service from .Net - XML Exchange Koushik .NET Web Services 0 October 23rd, 2006 11:40 AM
Apache, Axis and JDK for web service problem solomon_13000 Apache Tomcat 0 August 26th, 2005 08:16 AM

All times are GMT -4. The time now is 07:33 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.