A colleague of mine says this:
 
Dear Albert,
 
I think there are two ways two make enable .net wse soap stub to communicate with axis:
 
1. Register handlers in Axis to consume the .net generated soap headers (without doing anything in particular) and allowing the normal axis server to work normally.
 
2. Remove the soap headers from the .net soap stub.
 
I believe it is better to implement the first option, since it makes it easier for .net client to connect.
I tried both and found the second one easier to implement (and with the timing constraints in today's ...).
Here is a snippet of code implementing the removal of the soap headers from a .net c# wse soap stub:
 
<snippet>
      [ClassInterface(ClassInterfaceType.AutoDispatch)]
      public class AuganiserSoapService : WebServicesClientProtocol
      {
            //System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        /// <remarks/>
        public AuganiserSoapService(string pUrl) {
            this.Url = "">
                  // remove all the output filters - they generate the soap headers
                  for (int i = this.Pipeline.OutputFilters.Count -1 ; i > -1; i--)
                  {
                        this.Pipeline.OutputFilters.Remove(this.Pipeline.OutputFilters[i]);
                  }
        }
</snippet>
 
I remove all the output filter from the constructor of the soap stub.  Only two of them actually generate soap headers but removing them all
Does not seem to hinder the functionality of the stub.
 
Here is code that uses the  attachment functionality to get a document from an axis dime attachment.
 
<snippet> 
            public string getDocumentContent(string pDocumentId)
            {
                  AuganiserSoapService auganiserSoap = new AuganiserSoapService(mUrl);
                  auganiserSoap.getDocumentContent(mSessionId, pDocumentId);
                  if (auganiserSoap.ResponseSoapContext.Attachments.Count > 0)
                  {
                        // this attachment comes from axix
                        Stream input = auganiserSoap.ResponseSoapContext.Attachments[0].Stream;
                        // get the doc and shell it!!
                        SimpleDocument simpleDoc = this.getSimpleDocument(pDocumentId);
                        string tempFile = @"C:\temp\" + simpleDoc.fileName;
                        FileStream fileStream = new FileStream(tempFile, FileMode.Create);
                        for (int ch = input.ReadByte(); ch != -1;ch = input.ReadByte())
                        {
                              fileStream.WriteByte((byte) ch);
                        }
                        input.Close();
                        fileStream.Close();
                        return tempFile;
                  }
                  return null;
            }
</snippet>
 
and below is code that uploads the attachment to axis:
 
<snippet>
                        //
                        // Add the attachment.
                        //
                        DimeAttachment dimeAttachment = new DimeAttachment(
                              "application/octet", TypeFormatEnum.MediaType,
                              filePath);
                        FileInfo fileInfo = new FileInfo(filePath);
                        auganiserSoap.RequestSoapContext.Attachments.Add(dimeAttachment);
                        auganiserSoap.addDocument(mSessionId,
                              fileInfo.Name,
                              pContentClass,
                              props);
                  }
</snippet>
 
Good luck and happy computing
 
Igal
 
-----Original Message-----
From: albert kwan [mailto:[EMAIL PROTECTED]
Sent: 24 June 2003 09:16
To: [EMAIL PROTECTED]
Subject: Sending attachments between Axis and .Net

Hello,
 
I am working with Axis and .Net at the moment and have to
send attachments between them.
 
Any suggestions to "disable" the below soap fault?
 
Here is a summary of Sending attachments between Axis and .Net

Applies to:
   MicrosoftR C#.NET (Visual Studio 2003)
   Web Services Enhancements (WSE) 1.0 Service Pack 1 for MicrosoftR .NET
   Soap with Attachment specification
   WS-Attachments specification
   DIME specification
   Apache Axis 1.1
    J2sdk 1.4.1
    Tomcat 4.1.24

Web services Server:
    - Tomcat + Axis
    - able to receive
        - complex types (javabeans convention) as parameters
        - multiple MIME/DIME encoded attachments

Client A - Axis
    Complex Type    -    OK
    MIME                -    OK
    DIME                -    OK

Client B - C#.NET, default "Web References" (stub extends
        System.Web.Services.Protocols.SoapHttpClientProtocol )
    Complex Type    -    OK
    MIME                -    Not Supported
    DIME                -    Not Supported

Client C - C#.NET, WSE (stub extends
        Microsoft.Web.Services.WebServicesClientProtocol)
    Complex Type    -    OK
    MIME                -    Not Supported
    DIME                -    Supported, Axis received and handled attachment
successfully,
                                 but Axis cannot understand this Soap
Header, a soap fault is thrown

--Begin--
<wsrp:path soap:actor="http://schemas.xmlsoap.org/soap/actor/next"
soap:mustUnderstand="1"
xmlns:wsrp="http://schemas.xmlsoap.org/rp">
<wsrp:action></wsrp:action>
<wsrp:to>http://localhost:1234/GeneClusterProxyIF/services/GeneClusterProxyI
F</wsrp:to>
<wsrp:id>uuid:28cf2ed2-9ae8-49ff-9826-5c68992de82d</wsrp:id></wsrp:path>
--end--

Soap fault::
--Soap Fault--
  <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:MustUnderstand</faultcode>
   <faultstring>Did not understand &quot;MustUnderstand&quot;
header(s):</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

--Soap Fault--

Best regards,
Albert K.H.Kwan

Research Assistant
Department of Computer Science and Information Systems
The University of Hong Kong

Reply via email to