|
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
|
- Sending attachments between Axis and .Net albert kwan
- Re: Sending attachments between Axis and .Net Peter Ledbrook
- Re: Sending attachments between Axis and .Net albert kwan
