Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:07:22+00:00 2026-05-27T09:07:22+00:00

I am working with a wsdl which is automatically adding extra elements into the

  • 0

I am working with a wsdl which is automatically adding extra elements into the xml. In order for it to comply with an external web service that do not use these elements. See the following image:
http://img406.imageshack.us/img406/1307/differencese.png
Left = Red elements need removed – Right = What i need it to output

i have attached the code that is creating my envelope and payload.

    Dim content As myProxy.Content = New myProxy.Content
    Dim inputguid As String = Guid.NewGuid.ToString
    Dim service As myProxy.WebService = New myProxy.WebService
    Dim str As New System.Xml.XmlDocument
    Dim payload As myProxy.Payload = New myProxy.Payload

    'payload
    str.LoadXml(xmlstr)

    'manifest
    service.payloadManifest = New myProxy.PayloadManifest
    service.payloadManifest.manifest = New myProxy.Manifest() {New myProxy.Manifest}
    service.payloadManifest.manifest(0).element = "GetVehicleServiceHistory"
    service.payloadManifest.manifest(0).namespaceURI = ""
    service.payloadManifest.manifest(0).contentID = "Content0"
    service.payloadManifest.manifest(0).version = "2.01"
    service.SoapVersion = SoapProtocolVersion.Soap11

    service.UserAgent = "Jakarta Commons-HttpClient/3.1"
    Dim usertoken As New Microsoft.Web.Services3.Security.Tokens.UsernameToken("userid", "password", Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendPlainText)

    service.RequestSoapContext.Security.Tokens.Add(usertoken)
    service.RequestSoapContext.Security.MustUnderstand = False

    payload.content = New myProxy.Content() {content}
    ReDim Preserve payload.content(0)
    payload.content(0).Any = str.DocumentElement
    payload.content(0).id = "Content0"

    service.Url = "http://localhost:8080"
    service.ProcessMessage(payload)

Any help would be much appreciated.

Michael

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:07:23+00:00Added an answer on May 27, 2026 at 9:07 am
        Dim content As blah.Content = New blah.Content
        Dim inputguid As String = Guid.NewGuid.ToString
        Dim service As blah.WebService = New blah.WebService
        Dim str As New System.Xml.XmlDocument
        Dim payload As blah.Payload = New blah.Payload
    
        'payload
        str.LoadXml(xmlstr)
    
        'manifest
        service.payloadManifest = New blah.PayloadManifest
        service.payloadManifest.manifest = New blah.Manifest() {New blah.Manifest}
        service.payloadManifest.manifest(0).element = "GetVehicleServiceHistory"
        service.payloadManifest.manifest(0).namespaceURI = ""
        service.payloadManifest.manifest(0).contentID = "Content0"
        service.payloadManifest.manifest(0).version = "2.01"
        service.SoapVersion = SoapProtocolVersion.Soap11
    
        service.UserAgent = "Jakarta Commons-HttpClient/3.1"
    
    
        payload.content = New blah.Content() {content}
        ReDim Preserve payload.content(0)
        payload.content(0).Any = str.DocumentElement
        payload.content(0).id = "Content0"
    
        service.ProcessMessage(payload)
    

    noticed i’ve removed the WSE coding:-

    within the web reference reference.vb i’ve added the following code in the pcublic sub new –

            Dim policy As New Policy()
            policy.Assertions.Add(New MyAssertion())
            Me.SetPolicy(policy)
    

    and then

    Public Class MyPolicy
        Inherits SoapFilter
        Public Overrides Function ProcessMessage(ByVal envelope As SoapEnvelope) As SoapFilterResult
            'creating the <wsse:Security> element in the outgoing message
            Dim securityNode As XmlNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
            Dim securityAttr As XmlAttribute = envelope.CreateAttribute("soap:mustunderstand")
            securityAttr.Value = "1"
            'creating the <wsse:usernameToken> element
            Dim usernameTokenNode As XmlNode = envelope.CreateNode(XmlNodeType.Element, "wsse:UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
            Dim userElement As XmlElement = usernameTokenNode
            userElement.SetAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
    
    
            'creating the <wsse:Username> element
            Dim userNameNode As XmlNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Username", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
            userNameNode.InnerXml = "username"
    
    
            'creating the <wsse:password> element
            Dim pwdNode As XmlNode = envelope.CreateNode(XmlNodeType.Element, "wsse:Password", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
            Dim pwdElement As XmlElement = pwdNode
            pwdElement.SetAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText")
            pwdNode.InnerXml = "password"
    
            usernameTokenNode.AppendChild(userNameNode)
            usernameTokenNode.AppendChild(pwdNode)
            securityNode.AppendChild(usernameTokenNode)
            envelope.ImportNode(securityNode, True)
            Dim node As XmlNode = envelope.Header
            node.AppendChild(securityNode)
    
    
            Dim actionnode As XmlNode = envelope.Header("wsa:Action")
            envelope.Header.RemoveChild(actionnode)
    
            Dim messageNode As XmlNode = envelope.Header("wsa:MessageID")
            envelope.Header.RemoveChild(messageNode)
    
            Dim replyToNode As XmlNode = envelope.Header("wsa:ReplyTo")
            envelope.Header.RemoveChild(replyToNode)
    
            Dim toNode As XmlNode = envelope.Header("wsa:To")
            envelope.Header.RemoveChild(toNode)
    
            Return SoapFilterResult.[Continue]
        End Function
    End Class
    
    Public Class MyAssertion
        Inherits PolicyAssertion
        Public Overrides Function CreateClientInputFilter(ByVal context As FilterCreationContext) As SoapFilter
            Return Nothing
        End Function
    
        Public Overrides Function CreateClientOutputFilter(ByVal context As FilterCreationContext) As SoapFilter
            Return New MyPolicy()
        End Function
    
        Public Overrides Function CreateServiceInputFilter(ByVal context As FilterCreationContext) As SoapFilter
            Return Nothing
        End Function
    
        Public Overrides Function CreateServiceOutputFilter(ByVal context As FilterCreationContext) As SoapFilter
            Return Nothing
        End Function
    End Class
    

    Public Overrides Function ProcessMessage – overwrites the processmessage and lets me manually edit the envelope

    i needed to manually remove the elements i did not need and manually insert the elements Idid need:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the WSDL for a web service that I cannot currently connect to.
I'm working on a project that involves a simple web service, and have had
I am working a legacy web service app which we has now changed, so
I'm working on a Java 6 application server which has a web service for
I working on different web-services, and I always use WSDL First. JAXB generates for
Is there a straightforward way to query a web service to see which messages
Ive been trying to get an example Web Service working using SpringWS and Tomcat5.5
I got a PHP web service that had been running great for a long
Over a year ago I had been working on a WCF service, which I
I'm working on a couple of web services that use JAXB bindings for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.