Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2006, 07:14 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Send DIME Attachment from .Net Client(C#) to J2EE(

Hi



I am trying to send a DIME attachment from .Net Client(C#) to Java(Axis Web Service).

I am getting the following error message:

"An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll

Additional information: java.lang.NullPointerException"


Could you tell me what could be the reason for this.


I have attached below all the necessary information:

================================================== =========
.Net Code is as follows:

//Create a proxy class for the web service
GESAttachment.GESServiceServiceWse ws = new GESAttachment.GESServiceServiceWse();

//Convert the file to a Memory Stream
FileInfo fi = new FileInfo(FileName);
FileStream fs = fi.OpenRead();
byte [] bytes = new byte[fs.Length];
int numRead = fs.Read(bytes, 0, (int)fs.Length);
fs.Close();
MemoryStream ms = new MemoryStream(bytes);

//Create and Add the Attachment to the SOAPContext
DimeAttachment dimeAttach = new DimeAttachment("text/plain",TypeFormat.MediaType,ms);
ws.RequestSoapContext.Attachments.Add(dimeAttach);

//Call the Web service method
string strReturn = ws.processAttachments();
================================================== =========

================================================== =========
The TCPMONITOR exceptions is as follows:



<?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:Server.userException</faultcode>
            <faultstring>java.lang.NullPointerException</faultstring>
            <detail>
               <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">PCIIB16242</ns1:hostname>
            </detail>
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>
================================================== =========
JAVA WEB SERVICE CODE:


// Getting the messageContext instance
MessageContext messageContext = MessageContext.getCurrentContext();
Message msg = messageContext.getRequestMessage();
Attachments attachments = msg.getAttachmentsImpl();
================================================== =========

My WSDL as follows:


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ejb.poc.astrazeneca.com/GESService.wsdl" xmlns:impl="http://ejb.poc.astrazeneca.com/GESService.wsdl" xmlns:intf="http://ejb.poc.astrazeneca.com/GESService.wsdl" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ejb.poc.astrazeneca.com/GESService.wsdl" elementFormDefault="qualified">
   <element name="AttachmentPOCReturn" type="xsd:string"/>
   <element name="value" type="xsd:string"/>
   <element name="getAttachmentReturn" type="xsd:string"/>
  </schema>
 </wsdl:types>
   <wsdl:message name="getAttachmentRequest">
     <wsdl:part name="value" element="impl:value"/>
   </wsdl:message>
   <wsdl:message name="AttachmentPOCResponse">
      <wsdl:part name="AttachmentPOCReturn" element="impl:AttachmentPOCReturn"/>
   </wsdl:message>
   <wsdl:message name="getAttachmentResponse">
      <wsdl:part name="getAttachmentReturn" element="impl:getAttachmentReturn"/>
   </wsdl:message>
   <wsdl:message name="AttachmentPOCRequest">
   </wsdl:message>
   <wsdl:portType name="GESService">
      <wsdl:operation name="AttachmentPOC">
         <wsdl:input name="AttachmentPOCRequest" message="impl:AttachmentPOCRequest"/>
         <wsdl:output name="AttachmentPOCResponse" message="impl:AttachmentPOCResponse"/>
      </wsdl:operation>
      <wsdl:operation name="getAttachment" parameterOrder="value">
         <wsdl:input name="getAttachmentRequest" message="impl:getAttachmentRequest"/>
         <wsdl:output name="getAttachmentResponse" message="impl:getAttachmentResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="GESServiceSoapBinding" type="impl:GESService">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="AttachmentPOC">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="AttachmentPOCRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="AttachmentPOCResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="getAttachment">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getAttachmentRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="getAttachmentResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="GESServiceService">
      <wsdl:port name="GESService" binding="impl:GESServiceSoapBinding">
         <wsdlsoap:address location="http://pciib16242:8888/axis/services/GESService"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>
================================================== =========

Could you please throw some light on this?
 
Old June 28th, 2007, 07:01 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I was wondering if you ever fixed this problem ?
I have the exact same errors/problem as you.


Regards.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to send an email with an attachment in it samputha Excel VBA 2 August 13th, 2009 09:12 PM
Send Mail with Attachment using Asp rajchennai J2EE 0 June 30th, 2007 01:39 AM
how to send email with attachment using JSP kirtesh4u J2EE 0 May 19th, 2007 01:17 AM
How to Send Mail with attachment using JAVA rekha_jsr Classic ASP Basics 2 September 16th, 2004 01:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.