Hello,

I hopeful that someone can provide me with a bit of help. I have developed the below ASP.net web service (web service A) that calls another web service B. The aim of the web service A is to accept bank account details as parameters and generate some SOAP XML and post this to web service B capturing the SOAP Envelope response from web service B and then passing this back to web service A. The issue is that I need pass back the SOAP envelope resonse from web service B back exactly to web service A and cannot get it right. I can get the SOAP response from web service B ok but there is additional XML at the end that relates to web service A. Basically my SOAP response in web service A is a combination of the response from B + the reponse from A. Hope this makes sense - maybe the code below will be easier to read!


Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Net

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' _
_
_
_
Public Class Service1
    Inherits System.Web.Services.WebService

   
    http://microsoft.wcf.documentation", Name:="SampleService", ProtectionLevel:=ProtectionLevel.EncryptAndSign)> _
    Public Sub bankData(ByVal accountNumber As String, ByVal sortCode As String, ByVal country As String)

        'Retreive web service endpoint from web.config
        Dim endPoint As String = System.Web.Configuration.WebConfigurationManager.AppSettings("endPoint").ToString()

        'Define the SOAP XML and convert to Byte
        Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes( _
        "http://schemas.xmlsoap.org/soap/envelope/"" xmlns:cm=""http://oracle.com/CM-BkWSS.xsd"">" & System.Environment.NewLine & _
        "   " & System.Environment.NewLine & _
        "   " & System.Environment.NewLine & _
        "       " & System.Environment.NewLine & _
        "           " & sortCode & "" & System.Environment.NewLine & _
        "           " & accountNumber & "" & System.Environment.NewLine & _
        "           " & country & "" & System.Environment.NewLine & _
        "      
" & System.Environment.NewLine & _
        "  
" & System.Environment.NewLine & _
        "
")
        ' Run the web service
        runWebService(bytArguments, endPoint)

    End Sub

    Sub runWebService(bytArgumentsVal As Byte(), endPoint As String)
        'Define web client var
        Dim manualWebClient As New System.Net.WebClient()

        'Get CC&B user credentials from web.config file
        Dim user As String = System.Web.Configuration.WebConfigurationManager.AppSettings("userVal").ToString()
        Dim password As String = System.Web.Configuration.WebConfigurationManager.AppSettings("passVal").ToString()

        ' Define content type and add CC&B login details to the HTTP header
        manualWebClient.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8")
        manualWebClient.Credentials = New NetworkCredential(user, password)

        Try
            'Post to web service
            Dim bytRetData As Byte() = manualWebClient.UploadData(endPoint, "POST", bytArgumentsVal)

            'Read response
            'Return System.Text.Encoding.ASCII.GetString(bytRetData)

            Context.Response.Write(System.Text.Encoding.ASCII.GetString(bytRetData))
        Catch x As System.Net.WebException
            ' Return errors
            'Return x.Message
            Context.Response.Write(x.Message)
        End Try
    End Sub
End Class

The above program will receive the following Request:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
  
  
     
        
         ?
        
         ?
        
         ?
     

  



And will return below - I do not want it to return the highlighted text:


http://schemas.xmlsoap.org/soap/envelope/">
http://oracle.com/CM-BkWSS.xsd" faultStyle="wsdl">

  ?
  ?
  ?
 
    I
    Invalid
    E00001
    SOME ERROR TEXT.
 




http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> xmlns="http://tempuri.org/" />

Thanks in Advance

Sean