Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Sending DimeAttachment from a SoapClient to a SoapServer over TCP/

Reply
Thread Tools

Sending DimeAttachment from a SoapClient to a SoapServer over TCP/

 
 
KodeCruncher
Guest
Posts: n/a
 
      05-15-2006
Following is the code snippet.
StockQuoteClient inherits from SoapClient.
SoapClient calls a soapmethod through tcp/ip.
I need to add an attachment to my request.

when I try to get the current soapcontext using the following code it is
null.

SoapContext reqContext = RequestSoapContext.Current;

Any help is appreciated thanks.

private void btnGo_Click(object sender, System.EventArgs e)
{
//
String[] symbols = { "FABRIKAM", "CONTOSO" };
StockQuoteRequest request = new StockQuoteRequest();
request.Symbols = symbols;

Uri address = new
Uri("soap://stockservice.contoso.com/wse/samples/2003/06/TcpSyncStockService");
Uri via = new Uri("soap.tcp://" + System.Net.Dns.GetHostName() +
"/StockService");

StockQuoteClient proxy = new StockQuoteClient( new
EndpointReference(address, via));

Console.WriteLine("Calling {0}", proxy.Destination.Address.Value);


SoapContext reqContext = RequestSoapContext.Current;
DimeAttachment dimeAttach = new DimeAttachment(
"image/gif", TypeFormat.MediaType,
@"E:\Documents and Settings\kkode\Desktop\Aruna\logo_H.gif");

reqContext.Attachments.Add(dimeAttach);

StockQuotes quotes = proxy.GetStockQuotes( request );



foreach( StockQuote quote in quotes.Quotes )
{
Response.Write("");
Response.Write( "Symbol: " + quote.Symbol );
Response.Write( "\tName:\t\t\t" + quote.Name );
Response.Write( "\tLast Price:\t\t" + quote.Last );
Response.Write( "\tPrevious Change:\t" + quote.PreviousChange + "%");
}

}
 
Reply With Quote
 
 
 
 
KodeCruncher
Guest
Posts: n/a
 
      05-15-2006
I found the solution after digging around.
we can add the attachment to the soap envelope instead.
This soapenvelope can be sent to the server.

SoapEnvelope e = new SoapEnvelope();
e.SetBodyObject(message);
DimeAttachment dimeAttach = new DimeAttachment(
"image/gif", TypeFormat.MediaType,
@"E:\Documents and Settings\kkode\Desktop\Aruna\logo_H.gif");
dimeAttach.Id="Logo";






"KodeCruncher" wrote:

> Following is the code snippet.
> StockQuoteClient inherits from SoapClient.
> SoapClient calls a soapmethod through tcp/ip.
> I need to add an attachment to my request.
>
> when I try to get the current soapcontext using the following code it is
> null.
>
> SoapContext reqContext = RequestSoapContext.Current;
>
> Any help is appreciated thanks.
>
> private void btnGo_Click(object sender, System.EventArgs e)
> {
> //
> String[] symbols = { "FABRIKAM", "CONTOSO" };
> StockQuoteRequest request = new StockQuoteRequest();
> request.Symbols = symbols;
>
> Uri address = new
> Uri("soap://stockservice.contoso.com/wse/samples/2003/06/TcpSyncStockService");
> Uri via = new Uri("soap.tcp://" + System.Net.Dns.GetHostName() +
> "/StockService");
>
> StockQuoteClient proxy = new StockQuoteClient( new
> EndpointReference(address, via));
>
> Console.WriteLine("Calling {0}", proxy.Destination.Address.Value);
>
>
> SoapContext reqContext = RequestSoapContext.Current;
> DimeAttachment dimeAttach = new DimeAttachment(
> "image/gif", TypeFormat.MediaType,
> @"E:\Documents and Settings\kkode\Desktop\Aruna\logo_H.gif");
>
> reqContext.Attachments.Add(dimeAttach);
>
> StockQuotes quotes = proxy.GetStockQuotes( request );
>
>
>
> foreach( StockQuote quote in quotes.Quotes )
> {
> Response.Write("");
> Response.Write( "Symbol: " + quote.Symbol );
> Response.Write( "\tName:\t\t\t" + quote.Name );
> Response.Write( "\tLast Price:\t\t" + quote.Last );
> Response.Write( "\tPrevious Change:\t" + quote.PreviousChange + "%");
> }
>
> }

 
Reply With Quote
 
 
 
 
John Fullmer
Guest
Posts: n/a
 
      05-16-2006
Here's a great link on DIME. I have used it before for a number of
different things. Very cool.

http://www.codeproject.com/cs/webser...DIMEBridge.asp

~ John Fullmer

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Raw XML from SoapServer.SoapInvoke Request, Response, "" RobertHillEDS ASP General 2 09-22-2005 08:16 AM
Calling WebMethod from SoapClient api does not process umlaut character properly Jack Wright ASP .Net Web Services 1 08-25-2004 04:21 AM
WSE 2.0 SP1 SoapClient/Service and NAT Christopher Crooker ASP .Net Web Services 2 08-03-2004 08:05 PM
Problem to invoke a method of webservice from a C++ SoapClient Asha ASP .Net Web Services 0 05-19-2004 04:13 AM
"Cannot access a closed Stream" when using DimeAttachment Michael ASP .Net Web Services 0 05-13-2004 01:33 PM



Advertisments