You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by JEFF EMMINGER <je...@thig.com> on 2004/02/26 16:36:54 UTC

xml document always null?

hi all, 

i'm trying to create an xml document but all i get for output is
  el.toString = [foo: null]
  el.getNodeValue = null

can anyone see what i'm doing wrong?

[code]
import javax.xml.parsers.DocumentBuilder;
import org.apache.soap.util.xml.XMLParserUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class XmlTest {
	public static void main(String[] args) {
		DocumentBuilder db = XMLParserUtils.getXMLDocBuilder();
		Document doc = db.newDocument();
		
		Element el = doc.createElement("foo");
		el.appendChild( doc.createTextNode("bar") );
		
		System.out.println("el.toString = " + el.toString());
		System.out.println("el.getNodeValue = " +
el.getNodeValue());
	}
}
[/code]






CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.

Re: namespace errors

Posted by Brian Shields <bg...@yahoo.com>.
thanks scott. The DataHandler i am using contains an xml file, a way around using DataHandlers is to put the XML file into a string which can be done using JDOMs XMLOutputter.
Regards,
Brian.

Scott Nichol <sn...@scottnichol.com> wrote:
You get the error because Sun's implementation does not know about the http://xml.apache.org/xml-soap namespace. Some SOAP implementations build in some knowledge of that namespace, but it is not widely supported.

The whole notion of passing an attachment as a parameter is not universally supported, either. Nor is the WSDL representation of a message with attachments (http://www.w3.org/TR/wsdl#_Toc492291084).

My knowledge of Sun's support for attachments is incomplete. The SAAJ API is what I am familiar with. It is designed to allow you to create and examine SOAP messages that include attachments. Clients using SAAJ build and dissect messages at a low-level and use SOAPConnection for transport. I do not see any way to use JAX-RPC APIs, e.g. javax.xml.rpc.Call provides no access to attachments. As such, I doubt you can expect Sun's code to consume WSDL for a call with an attachment, even if the WSDL includes a MIME description and the attachment is not also a parameter.

So, with JWSDP, I think you are left to use SAAJ to interact with your service.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Brian Shields" 
To: 
Sent: Thursday, February 26, 2004 12:05 PM
Subject: namespace errors



Hi All,

I have created a webservice using apache soap. One of the service methods accepts a DataHandler object from the javax.activation package. This appears in the WSDL file as a DataHandler from the http://xml.apache.org/xml-soap This is giving a "model error" when stubs are created from a JWSDP client! Does anyone know why?

Thanks,

Brian.


---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

Re: namespace errors

Posted by Scott Nichol <sn...@scottnichol.com>.
You get the error because Sun's implementation does not know about the http://xml.apache.org/xml-soap namespace.  Some SOAP implementations build in some knowledge of that namespace, but it is not widely supported.

The whole notion of passing an attachment as a parameter is not universally supported, either.  Nor is the WSDL representation of a message with attachments (http://www.w3.org/TR/wsdl#_Toc492291084).

My knowledge of Sun's support for attachments is incomplete.  The SAAJ API is what I am familiar with.  It is designed to allow you to create and examine SOAP messages that include attachments.  Clients using SAAJ build and dissect messages at a low-level and use SOAPConnection for transport.  I do not see any way to use JAX-RPC APIs, e.g. javax.xml.rpc.Call provides no access to attachments.  As such, I doubt you can expect Sun's code to consume WSDL for a call with an attachment, even if the WSDL includes a MIME description and the attachment is not also a parameter.

So, with JWSDP, I think you are left to use SAAJ to interact with your service.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Brian Shields" <bg...@yahoo.com>
To: <so...@ws.apache.org>
Sent: Thursday, February 26, 2004 12:05 PM
Subject: namespace errors



Hi All,

I have created a webservice using apache soap. One of the service methods accepts a DataHandler object from the javax.activation package. This appears in the WSDL file as a DataHandler from the http://xml.apache.org/xml-soap This is giving a "model error" when stubs are created from a JWSDP client! Does anyone know why?

Thanks,

Brian.


---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

namespace errors

Posted by Brian Shields <bg...@yahoo.com>.
Hi All,

I have created a webservice using apache soap. One of the service methods accepts a DataHandler object from the javax.activation package. This appears in the WSDL file as a DataHandler from the http://xml.apache.org/xml-soap This is giving a "model error" when stubs are created from a JWSDP client! Does anyone know why?

Thanks,

Brian.


---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

Re: xml document always null?

Posted by Martin Gainty <mg...@hotmail.com>.
xml document always null?Jeff-
where is the 
toString
getNodeValue code?
Best Regards,
Martin Gainty
  ----- Original Message ----- 
  From: JEFF EMMINGER 
  To: 'soap-user@ws.apache.org' 
  Sent: Thursday, February 26, 2004 10:36 AM
  Subject: xml document always null?


  hi all, 

  i'm trying to create an xml document but all i get for output is 
    el.toString = [foo: null] 
    el.getNodeValue = null 

  can anyone see what i'm doing wrong? 

  [code] 
  import javax.xml.parsers.DocumentBuilder; 
  import org.apache.soap.util.xml.XMLParserUtils; 
  import org.w3c.dom.Document; 
  import org.w3c.dom.Element; 

  public class XmlTest { 
          public static void main(String[] args) { 
                  DocumentBuilder db = XMLParserUtils.getXMLDocBuilder(); 
                  Document doc = db.newDocument(); 
                  
                  Element el = doc.createElement("foo"); 
                  el.appendChild( doc.createTextNode("bar") ); 
                  
                  System.out.println("el.toString = " + el.toString()); 
                  System.out.println("el.getNodeValue = " + el.getNodeValue()); 
          } 
  } 
  [/code] 







  CONFIDENTIAL NOTICE: This email including any attachments, contains 
  confidential information belonging to the sender. It may also be 
  privileged or otherwise protected by work product immunity or other 
  legal rules. This information is intended only for the use of the 
  individual or entity named above.  If you are not the intended 
  recipient, you are hereby notified that any disclosure, copying, 
  distribution or the taking of any action in reliance on the contents 
  of this emailed information is strictly prohibited.  If you have 
  received this email in error, please immediately notify us by 
  reply email of the error and then delete this email immediately. 

Re: xml document always null?

Posted by Scott Nichol <sn...@scottnichol.com>.
Apache SOAP includes a class to help serialize a Node.  In org.apache.soap.util.xml.DOM2Writer, there is a method

    public static String nodeToString(Node node)

to get stringized XML.  There is also

    public static void serializeAsXML(Node node, Writer writer)

to output to any Writer.  I would be interested to hear what you get from nodeToString(doc).

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "JEFF EMMINGER" <je...@thig.com>
To: <so...@ws.apache.org>
Sent: Thursday, February 26, 2004 10:36 AM
Subject: xml document always null?


hi all, 

i'm trying to create an xml document but all i get for output is
  el.toString = [foo: null]
  el.getNodeValue = null

can anyone see what i'm doing wrong?

[code]
import javax.xml.parsers.DocumentBuilder;
import org.apache.soap.util.xml.XMLParserUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class XmlTest {
public static void main(String[] args) {
DocumentBuilder db = XMLParserUtils.getXMLDocBuilder();
Document doc = db.newDocument();

Element el = doc.createElement("foo");
el.appendChild( doc.createTextNode("bar") );

System.out.println("el.toString = " + el.toString());
System.out.println("el.getNodeValue = " +
el.getNodeValue());
}
}
[/code]






CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.


RE: xml document always null?

Posted by bertrand lancelot <bl...@partner.auchan.com>.
Test it :
el.setNodeValue( "bar");

best regards;


-----Message d'origine-----
De : JEFF EMMINGER [mailto:jemminger@thig.com]
Envoyé : jeudi 26 février 2004 16:37
À : 'soap-user@ws.apache.org'
Objet : xml document always null?


hi all,
i'm trying to create an xml document but all i get for output is
  el.toString = [foo: null]
  el.getNodeValue = null
can anyone see what i'm doing wrong?
[code]
import javax.xml.parsers.DocumentBuilder;
import org.apache.soap.util.xml.XMLParserUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class XmlTest {
        public static void main(String[] args) {
                DocumentBuilder db = XMLParserUtils.getXMLDocBuilder();
                Document doc = db.newDocument();

                Element el = doc.createElement("foo");
                el.appendChild( doc.createTextNode("bar") );

                System.out.println("el.toString = " + el.toString());
                System.out.println("el.getNodeValue = " +
el.getNodeValue());
        }
}
[/code]






CONFIDENTIAL NOTICE: This email including any attachments, contains
confidential information belonging to the sender. It may also be
privileged or otherwise protected by work product immunity or other
legal rules. This information is intended only for the use of the
individual or entity named above.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or the taking of any action in reliance on the contents
of this emailed information is strictly prohibited.  If you have
received this email in error, please immediately notify us by
reply email of the error and then delete this email immediately.