Groups > Asp .Net > ASP.NET XML Web Services > Re: Edit outgoing SOAP request and WSDL




Edit outgoing SOAP request and WSDL

Edit outgoing SOAP request and WSDL
Thu, 27 Mar 2008 14:01:37 +000
Hi.

 I am writing a SOAP Web Service using C#. I need to do something a little
tricky.

 Now, I have a tag within the SOAP request that serves as a placeholder for
datatypes the nature of which may be determind via an xsi:type attribute.

Say I have a SOAP request skeleton like:

<request>
  <placeholder/> 
</request>

 
 And I'll send the following in the request from the client:

<request>
  <placeholder xs:type="nsblah:placeholder_type">
    <placeholder_type_object_members/>
  </placeholder>
</request> 

where xmlns:xs="http://www.w3.org/2001/XMLSchema" and
xmlns:nsblah="my_custom_namespace"


 Now, there are two problems:

1) I need to transfer the definition of the placeholder_type object and the
associated namespaces (I could edit the wsdl, but it is generated automatically
by the .NET web service framework, and I can't find how to add my types
automatically to that generated wsdl).

2) the xs:type of the placeholder tag will differ, and I am not sure if
depending upon the object assigned to the placeholder variable on the client,
the outgoing SOAP request will have the appropriate xs:type attribute.

 

 So, I need to find out how to add my edits to the wsdl each time it is
generated, AND how can I edit the outgoing SOAP request from the client to
include the proper xs:type

I already know about the SoapExtension class, but I don't know how I would
invoke it upon each outgoing request. I use it for incoming requests, but there
I have a custom attribute written that I can label the WebMethods with.
 

Thanks in advance.
Post Reply
Re: Edit outgoing SOAP request and WSDL
Mon, 31 Mar 2008 15:02:44 +000
As a solution, I ended up <wsdl:import>'ing handwritten schemas.

 This is going to be a bit tricky for someone other than me to maintain.

 

Also,  

I'm having to manually deserialise the generic types, as it doesn't know what C#
class it must deserialise to as I cannot correlate the schema type with the
class.

Is there some other way I can influence the deserialisation process?
SoapExtension allows you to influence processing 'BeforeDeserialize' and
'AfterDeserialize'. How can I add my own code to deserialise instead of the SOAP
framework doing it itself?
Post Reply
about | contact