ws-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Robinson <craig.robin...@epa.qld.gov.au>
Subject RE: Help defining namespace
Date Wed, 14 Apr 2004 06:10:00 GMT
Thanks Scott,
Sorry for the tardiness in getting back to you, but I have been trying to work this out. In
my test client, the DOM gets created as follows:

try {
  // Create a builder factory
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  factory.setValidating(validating);

  // Create the builder and parse the file
  Document doc = factory.newDocumentBuilder().parse(new File(filename));
  return doc; 
}

where the file it reads, contains some simple XML like:

<message type="submit">
  <name>
    <given_name>John</given_name>
    <surname>Citizen</surname>
  </name>
</message>

Therefore, when it gets sent using the method below, it ends up getting sent like:

<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>
 <ns1:null xmlns:ns1="" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
  <message type="submit">
    <name>
      <given_name>John</given_name>
      <surname>Citizen</surname>
    </name>
  </message>
 </ns1:null >
 </soapenv:Body>
</soapenv:Envelope>

Any help would be greatly appreciated.
Cheers, Craig

> -----Original Message-----
> From: Scott Nichol [mailto:snicholnews@scottnichol.com]
> Sent: Tuesday, 6 April 2004 11:02 PM
> To: soap-user@ws.apache.org
> Subject: Re: Help defining namespace
> 
> 
> Your code looks like what I would expect.  The generated 
> payload, however, has a root element
> 
> <ns1:null xmlns:ns1="" 
> 
> which looks like there is neither name nor namespace on the 
> root Element.  It seems like the DOM Element probably has no 
> namespace.  How do you create the DOM in the first place?
> 
> 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: "Craig Robinson" <craig.robinson@epa.qld.gov.au>
> To: <soap-user@ws.apache.org>
> Sent: Monday, April 05, 2004 6:37 PM
> Subject: Help defining namespace
> 
> 
> Hi,
> This may seem like a very basic question, but I am stumped. 
> Hope someone can help! I have an XML DOM document which I 
> need to send to a web service from a message driven bean.  
> The appropriate code snippet that I am using is:
> 
> Element message = doc.getDocumentElement();
> Call call = new Call ();
> call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML );
> Vector params = new Vector ();
> params.addElement (new Parameter("message", Element.class, 
> message, Constants.NS_URI_LITERAL_XML));
> call.setParams (params);
> URL url = new URL ("http://localhost:8080/webservice/");
> Response resp = call.invoke (url, "");
> 
> It sends a message like:
> 
> <SOAP-ENV:Envelope ...>
> <SOAP-ENV:Body>
> <ns1:null xmlns:ns1="" 
> SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
> ...DOM Document...
> </ns1:null>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> What I need to do is define a namespace like:
> 
> <ns1:AMessage xmlns:ns1="http://myurl" 
> SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
> 
> How do I do this? Any help would be greatly appreciated.
> 
> Cheers, Craig
> 
> Craig Robinson
> Information Systems Unit
> Corporate Development Division
> Environmental Protection Agency
> 
> Ph: (07) 3006 4629
> Fax:  (07) 3227 6534
> Mobile: 0411 477 921
> E-mail: craig.robinson@epa.qld.gov.au
> 
> Visit us online at www.epa.qld.gov.au
> 
> 
> 
> ___________________________
> Disclaimer
> 
> This e-mail, including attachments if any, has originated 
> from a Queensland government agency and may contain 
> information that is confidential, or covered by legal 
> professional privilege, and is intended for the named 
> recipient(s) only.  If you have received this message in 
> error, you are asked to inform the sender as quickly as 
> possible and delete this message and any copies of this 
> message from your computer system network.
> 
> Any form of disclosure, modification, distribution and/or 
> publication of this e-mail, including attachments is 
> prohibited.  Unless otherwise stated, this e-mail, including 
> attachments represents the views of the sender and not the 
> views of the Environmental Protection Agency.
> 
> Although this e-mail has been checked for the presence of 
> computer viruses, the Environmental Protection Agency 
> provides no warranty that all possible viruses have been 
> detected and cleaned.  Any use of this e-mail could harm your 
> computer system.
> ___________________________
> 
> 
> 



___________________________
Disclaimer

This e-mail, including attachments if any, has originated from a Queensland government agency
and may contain information that is confidential, or covered by legal professional privilege,
and is intended for the named recipient(s) only.  If you have received this message in error,
you are asked to inform the sender as quickly as possible and delete this message and any
copies of this message from your computer system network.

Any form of disclosure, modification, distribution and/or publication of this e-mail, including
attachments is prohibited.  Unless otherwise stated, this e-mail, including attachments represents
the views of the sender and not the views of the Environmental Protection Agency.

Although this e-mail has been checked for the presence of computer viruses, the Environmental
Protection Agency provides no warranty that all possible viruses have been detected and cleaned.
 Any use of this e-mail could harm your computer system.
___________________________


Mime
View raw message