Webservice needed to conform to someone else predefined soap format

Discussion in 'ASP.NET WebServices' started by deadtroll, Mar 29, 2012.

Thread Status:
Not open for further replies.
  1. I need to create a webservice where the out put matches someone elses predefined soap message. It's an authentication web service, I just need help getting the response to match their examples. I can post their wsdl if needed but it's unformated and hard to read.

    Their example response is supposed to look like this.
    Code:
    <AuthenticateResponse>
       <AuthenticateResult>true</AuthenticateResult>
       <ResultMetaData>
          <ResultCode>0</ResultCode>
          <ResultMessage>Message</ResultMessage>
          <ResultDescription>Description</ResultDescription>
       </ResultMetaData>
    </AuthenticateResponse>
    
    So I created two serializable classes Authorization, ResultData
    Code:
    <Serializable()> _
    Public Class Authorization
        Property AuthenticateResult As Boolean
        Property ResultMetaData As ResultData
    End Class
    <Serializable()> _
    Public Class ResultData
        Property ResultCode As Integer
        Property ResultMessage As String
        Property ResultDescription As String
    End Class
    
    and my webservice function returns type is Authorization. However the soap 1.1 return looks like this...which they say won't work for them...
    Code:
        <AuthenticateResponse xmlns="http://mydomain.com/auth/">
          <AuthenticateResult>
            <AuthenticateResult>boolean</AuthenticateResult>
            <ResultMetaData>
              <ResultCode>int</ResultCode>
              <ResultMessage>string</ResultMessage>
              <ResultDescription>string</ResultDescription>
            </ResultMetaData>
          </AuthenticateResult>
        </AuthenticateResponse>
    
    Anyone have any suggestions on how to make them closer?
  2. So you have a wsdl and you need to create a web service that matches the contract defined in the wsdl? Is that what you're trying to do?

    If so I wouldn't bother trying to hand crank classes to try and match the wsdl definition - the easy way is to use the .NET SDK wsdl.exe tool and let it do the hard work. Generally wsdl.exe is used to generate client proxy classes to hosted web services but it can also be used to create a web service from a wsdl file.

    Note wsdl.exe creates legacy asmx .NET 2.0 quality code so if you want newer WCF code you can use the svcutil.exe tool to generate WCF service contracts.
  3. Yes thats what I was saying. I'm running into the problem of an incorrectly formatted wsdl now... they only reference their wsdl is in their documentation so now I'm left trying to fix it. *eye roll* .... Thanks for the tip on svcutil as well I've not seen any reference to that up until now.
Thread Status:
Not open for further replies.

Share This Page