You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Kransen, J." <j....@srn.minjus.nl> on 2004/10/12 10:25:13 UTC

newbie: namespace error

Hello, I'm trying to make a SOAP call with the following code:

	// Maak de SOAP verbinding
	SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
	SOAPConnection soapConnection = scf.createConnection();
	SOAPFactory sf = SOAPFactory.newInstance();

	// Maak het SOAP bericht
	MessageFactory mf = MessageFactory.newInstance();
	SOAPMessage message = mf.createMessage();

	// Ga naar de SOAP body            
	SOAPPart soapPart = message.getSOAPPart();
	SOAPEnvelope envelope = soapPart.getEnvelope();
	SOAPBody body = envelope.getBody();
	// Vul de body van de message
	Name bodyName = sf.createName("fetchClientRISc", "S2",
"urn:tempuri-org:RISC");
	SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
	// CVS nummer
	Name clientNummerName = sf.createName("piClieNr");
	SOAPElement clientNummer =
bodyElement.addChildElement(clientNummerName);
	clientNummer.addTextNode(clientgegevens.getCvsNummer());
	// Gebruikersnaam
	Name gebruikersnaamName = sf.createName("pcMedewerker");
	SOAPElement gebruikersnaam =
bodyElement.addChildElement(gebruikersnaamName);
	gebruikersnaam.addTextNode(request.getRemoteUser());

	System.out.println("\n\n==== SOAP BEGIN ==== \n\n");
	System.out.println("SOAP Request gestuurd:");
	message.writeTo(System.out);

	// Zet de ESB (Enterprise Service Bus) als bestemming
	URL bus = new URL("http://hpcu700372:2582/risc/reply");
	// Stuur de request, en vang de response op 
	SOAPMessage soapResponse = soapConnection.call(message, bus);

	System.out.println("\n\n==== REQUEST END; RESPONSE BEGIN ====
\n\n");

	System.out.println("SOAP Response ontvangen:");
	soapResponse.writeTo(System.out);

	System.out.println("\n\n==== SOAP END ==== \n\n");

	// sluit de verbinding
	soapConnection.close();

The code sends the following SOAP call:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<S2:fetchClientRISc xmlns:S2="urn:tempuri-org:RISC">
<piClieNr>2</piClieNr>
<pcMedewerker>manager</pcMedewerker>
</S2:fetchClientRISc>
</soap-env:Body>
</soap-env:Envelope>

I get the following response:

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Een fout was ontdekt in de Web Service aanvraag.
(10894)</faultstring>
<detail>
<ns1:FaultDetail xmlns:ns1="http://localhost/wsa"><errorMessage>Fout in SOAP
parameter: NAMESPACE_ERR: An attempt is made to create or change an object
in a way which is incorrect with regard to namespaces.
(10914)</errorMessage>
<requestID>a6752a3daf51bfb7:18166e5:ff8be1d288:-7ffa#9</requestID>
</ns1:FaultDetail>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

What does this mean? 

Jeroen Kransen


Dit e-mailbericht met eventuele bijlage(n) is uitsluitend bestemd voor de geadresseerde(n) en strikt vertrouwelijk. Indien u niet de geadresseerde bent, verzoeken wij u dit bericht en eventuele bijlage(n) aan de afzender terug te sturen en alle kopieën ervan te wissen en te vernietigen. Hoewel Reclassering Nederland alle zorg besteedt aan correcte en veilige inhoud, is zij niet aansprakelijk voor virussen in verzonden e-mailberichten met eventuele bijlage(n). Aan dit bericht kunnen geen rechten worden ontleend. 
This e-mail message, including any attachment(s), is intended solely for the addressee(s) and is strictly confidential. If you are not the intended recipient of this message, please return this e-mail and the attachment(s) to the sender and delete and destroy all copies. Despite all its efforts to ensure that this e-mail has a correct and save content, Reclassering Nederland is not liable for any viruses contained in this e-mail message and/or in the attachment(s). No rights can be claimed on the basis of this e-mail message. 




RE: newbie: namespace error

Posted by sm...@spansurf.com.
Hi Patrick,

I don't think namespacing the elements is required as they will adopt the 
namespace of thier parent. This does on up the chain until a namespace for an 
element is resolved.

Regards

Steve

Quoting Patrick Herber <pa...@arpage.ch>:

> Hello;
> 
> NAMESPACE_ERR is raised if the qualifiedName is malformed, if the
> qualifiedName has a prefix and the namespaceURI is null, or if the
> qualifiedName has a prefix that is "xml" and the namespaceURI is different
> from "http://www.w3.org/XML/1998/namespace" [Namespaces].
> 
> In your case is not that you also should prefix the elements:
> <piClieNr>2</piClieNr> 
> <pcMedewerker>manager</pcMedewerker>
> ?
> 
> Regards,
> Patrick
> 
> > -----Original Message-----
> > From: Kransen, J. [mailto:j.kransen@srn.minjus.nl] 
> > Sent: Dienstag, 12. Oktober 2004 10:25
> > To: 'axis-user@ws.apache.org'
> > Subject: newbie: namespace error
> > 
> > Hello, I'm trying to make a SOAP call with the following code:
> > 
> > 	// Maak de SOAP verbinding
> > 	SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
> > 	SOAPConnection soapConnection = scf.createConnection();
> > 	SOAPFactory sf = SOAPFactory.newInstance();
> > 
> > 	// Maak het SOAP bericht
> > 	MessageFactory mf = MessageFactory.newInstance();
> > 	SOAPMessage message = mf.createMessage();
> > 
> > 	// Ga naar de SOAP body            
> > 	SOAPPart soapPart = message.getSOAPPart();
> > 	SOAPEnvelope envelope = soapPart.getEnvelope();
> > 	SOAPBody body = envelope.getBody();
> > 	// Vul de body van de message
> > 	Name bodyName = sf.createName("fetchClientRISc", "S2", 
> > "urn:tempuri-org:RISC");
> > 	SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
> > 	// CVS nummer
> > 	Name clientNummerName = sf.createName("piClieNr");
> > 	SOAPElement clientNummer =
> > bodyElement.addChildElement(clientNummerName);
> > 	clientNummer.addTextNode(clientgegevens.getCvsNummer());
> > 	// Gebruikersnaam
> > 	Name gebruikersnaamName = sf.createName("pcMedewerker");
> > 	SOAPElement gebruikersnaam =
> > bodyElement.addChildElement(gebruikersnaamName);
> > 	gebruikersnaam.addTextNode(request.getRemoteUser());
> > 
> > 	System.out.println("\n\n==== SOAP BEGIN ==== \n\n");
> > 	System.out.println("SOAP Request gestuurd:");
> > 	message.writeTo(System.out);
> > 
> > 	// Zet de ESB (Enterprise Service Bus) als bestemming
> > 	URL bus = new URL("http://hpcu700372:2582/risc/reply");
> > 	// Stuur de request, en vang de response op 
> > 	SOAPMessage soapResponse = soapConnection.call(message, bus);
> > 
> > 	System.out.println("\n\n==== REQUEST END; RESPONSE 
> > BEGIN ==== \n\n");
> > 
> > 	System.out.println("SOAP Response ontvangen:");
> > 	soapResponse.writeTo(System.out);
> > 
> > 	System.out.println("\n\n==== SOAP END ==== \n\n");
> > 
> > 	// sluit de verbinding
> > 	soapConnection.close();
> > 
> > The code sends the following SOAP call:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soap-env:Envelope
> > xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
> > <soap-env:Header/>
> > <soap-env:Body>
> > <S2:fetchClientRISc xmlns:S2="urn:tempuri-org:RISC"> 
> > <piClieNr>2</piClieNr> <pcMedewerker>manager</pcMedewerker>
> > </S2:fetchClientRISc>
> > </soap-env:Body>
> > </soap-env:Envelope>
> > 
> > I get the following response:
> > 
> > <?xml version='1.0' encoding='UTF-8'?>
> > <SOAP-ENV:Envelope
> > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <SOAP-ENV:Body>
> > <SOAP-ENV:Fault>
> > <faultcode>SOAP-ENV:Client</faultcode>
> > <faultstring>Een fout was ontdekt in de Web Service aanvraag.
> > (10894)</faultstring>
> > <detail>
> > <ns1:FaultDetail 
> > xmlns:ns1="http://localhost/wsa"><errorMessage>Fout in SOAP
> > parameter: NAMESPACE_ERR: An attempt is made to create or 
> > change an object in a way which is incorrect with regard to 
> > namespaces.
> > (10914)</errorMessage>
> > <requestID>a6752a3daf51bfb7:18166e5:ff8be1d288:-7ffa#9</requestID>
> > </ns1:FaultDetail>
> > </detail>
> > </SOAP-ENV:Fault>
> > </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> > 
> > What does this mean? 
> > 
> > Jeroen Kransen
> > 
> > 
> > Dit e-mailbericht met eventuele bijlage(n) is uitsluitend 
> > bestemd voor de geadresseerde(n) en strikt vertrouwelijk. 
> > Indien u niet de geadresseerde bent, verzoeken wij u dit 
> > bericht en eventuele bijlage(n) aan de afzender terug te 
> > sturen en alle kopieën ervan te wissen en te vernietigen. 
> > Hoewel Reclassering Nederland alle zorg besteedt aan correcte 
> > en veilige inhoud, is zij niet aansprakelijk voor virussen in 
> > verzonden e-mailberichten met eventuele bijlage(n). Aan dit 
> > bericht kunnen geen rechten worden ontleend. 
> > This e-mail message, including any attachment(s), is intended 
> > solely for the addressee(s) and is strictly confidential. If 
> > you are not the intended recipient of this message, please 
> > return this e-mail and the attachment(s) to the sender and 
> > delete and destroy all copies. Despite all its efforts to 
> > ensure that this e-mail has a correct and save content, 
> > Reclassering Nederland is not liable for any viruses 
> > contained in this e-mail message and/or in the attachment(s). 
> > No rights can be claimed on the basis of this e-mail message. 
> > 
> > 
> > 
> > 
> 
> 
> 





RE: newbie: namespace error

Posted by Patrick Herber <pa...@arpage.ch>.
Hello;

NAMESPACE_ERR is raised if the qualifiedName is malformed, if the
qualifiedName has a prefix and the namespaceURI is null, or if the
qualifiedName has a prefix that is "xml" and the namespaceURI is different
from "http://www.w3.org/XML/1998/namespace" [Namespaces].

In your case is not that you also should prefix the elements:
<piClieNr>2</piClieNr> 
<pcMedewerker>manager</pcMedewerker>
?

Regards,
Patrick

> -----Original Message-----
> From: Kransen, J. [mailto:j.kransen@srn.minjus.nl] 
> Sent: Dienstag, 12. Oktober 2004 10:25
> To: 'axis-user@ws.apache.org'
> Subject: newbie: namespace error
> 
> Hello, I'm trying to make a SOAP call with the following code:
> 
> 	// Maak de SOAP verbinding
> 	SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
> 	SOAPConnection soapConnection = scf.createConnection();
> 	SOAPFactory sf = SOAPFactory.newInstance();
> 
> 	// Maak het SOAP bericht
> 	MessageFactory mf = MessageFactory.newInstance();
> 	SOAPMessage message = mf.createMessage();
> 
> 	// Ga naar de SOAP body            
> 	SOAPPart soapPart = message.getSOAPPart();
> 	SOAPEnvelope envelope = soapPart.getEnvelope();
> 	SOAPBody body = envelope.getBody();
> 	// Vul de body van de message
> 	Name bodyName = sf.createName("fetchClientRISc", "S2", 
> "urn:tempuri-org:RISC");
> 	SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
> 	// CVS nummer
> 	Name clientNummerName = sf.createName("piClieNr");
> 	SOAPElement clientNummer =
> bodyElement.addChildElement(clientNummerName);
> 	clientNummer.addTextNode(clientgegevens.getCvsNummer());
> 	// Gebruikersnaam
> 	Name gebruikersnaamName = sf.createName("pcMedewerker");
> 	SOAPElement gebruikersnaam =
> bodyElement.addChildElement(gebruikersnaamName);
> 	gebruikersnaam.addTextNode(request.getRemoteUser());
> 
> 	System.out.println("\n\n==== SOAP BEGIN ==== \n\n");
> 	System.out.println("SOAP Request gestuurd:");
> 	message.writeTo(System.out);
> 
> 	// Zet de ESB (Enterprise Service Bus) als bestemming
> 	URL bus = new URL("http://hpcu700372:2582/risc/reply");
> 	// Stuur de request, en vang de response op 
> 	SOAPMessage soapResponse = soapConnection.call(message, bus);
> 
> 	System.out.println("\n\n==== REQUEST END; RESPONSE 
> BEGIN ==== \n\n");
> 
> 	System.out.println("SOAP Response ontvangen:");
> 	soapResponse.writeTo(System.out);
> 
> 	System.out.println("\n\n==== SOAP END ==== \n\n");
> 
> 	// sluit de verbinding
> 	soapConnection.close();
> 
> The code sends the following SOAP call:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <soap-env:Envelope
> xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
> <soap-env:Header/>
> <soap-env:Body>
> <S2:fetchClientRISc xmlns:S2="urn:tempuri-org:RISC"> 
> <piClieNr>2</piClieNr> <pcMedewerker>manager</pcMedewerker>
> </S2:fetchClientRISc>
> </soap-env:Body>
> </soap-env:Envelope>
> 
> I get the following response:
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <SOAP-ENV:Body>
> <SOAP-ENV:Fault>
> <faultcode>SOAP-ENV:Client</faultcode>
> <faultstring>Een fout was ontdekt in de Web Service aanvraag.
> (10894)</faultstring>
> <detail>
> <ns1:FaultDetail 
> xmlns:ns1="http://localhost/wsa"><errorMessage>Fout in SOAP
> parameter: NAMESPACE_ERR: An attempt is made to create or 
> change an object in a way which is incorrect with regard to 
> namespaces.
> (10914)</errorMessage>
> <requestID>a6752a3daf51bfb7:18166e5:ff8be1d288:-7ffa#9</requestID>
> </ns1:FaultDetail>
> </detail>
> </SOAP-ENV:Fault>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> What does this mean? 
> 
> Jeroen Kransen
> 
> 
> Dit e-mailbericht met eventuele bijlage(n) is uitsluitend 
> bestemd voor de geadresseerde(n) en strikt vertrouwelijk. 
> Indien u niet de geadresseerde bent, verzoeken wij u dit 
> bericht en eventuele bijlage(n) aan de afzender terug te 
> sturen en alle kopieën ervan te wissen en te vernietigen. 
> Hoewel Reclassering Nederland alle zorg besteedt aan correcte 
> en veilige inhoud, is zij niet aansprakelijk voor virussen in 
> verzonden e-mailberichten met eventuele bijlage(n). Aan dit 
> bericht kunnen geen rechten worden ontleend. 
> This e-mail message, including any attachment(s), is intended 
> solely for the addressee(s) and is strictly confidential. If 
> you are not the intended recipient of this message, please 
> return this e-mail and the attachment(s) to the sender and 
> delete and destroy all copies. Despite all its efforts to 
> ensure that this e-mail has a correct and save content, 
> Reclassering Nederland is not liable for any viruses 
> contained in this e-mail message and/or in the attachment(s). 
> No rights can be claimed on the basis of this e-mail message. 
> 
> 
> 
>