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 Edison Aspert <as...@yahoo.com> on 2007/06/11 20:27:43 UTC

Axis 1.4 : Prefixed namespace bindings may not be empty error in doc ws

Hello,

I have developed a DOC WS in Axis 1.4. I am not using
any custom serializer or de-serializers. Whatever the
paramter (payload) to the webservice is, I intend to
receive it as a DOM Element in the WS implementation. 

Here is my Service implementation:

public class ContractWebservice 
{
public Element findPriceByCriteria(Element payload)
{
    System.out.println("In price by criteria");
    //Some JAXB stuff.
}
}

WSDD:

<service name="ContractServicePort"
provider="java:RPC" style="document" use="literal">
<parameter name="wsdlTargetNamespace"
value="http://xmlns.myws.com/gco/services/Contract/v1"/>
      <parameter name="wsdlServiceElement"
value="ContractService"/>
      <parameter name="schemaQualified"
value="http://xmlns.myws.com/gco/datatypes/Contract/v1,http://xmlns.myws.com/gco/doctypes/Contract/v1"/>
      <parameter name="schemaUnqualified"
value="http://xmlns.myws.com/gco/services/Contract/v1"/>
      <parameter name="wsdlServicePort"
value="ContractServicePort"/>
      <parameter name="className"
value="com.myws.webservice.ContractWebservice"/>
      <parameter name="wsdlPortType"
value="ContractClient"/>
      <parameter name="typeMappingVersion"
value="1.2"/>
      <operation name="findPriceByCriteria"
qname="findPriceByCriteria"
returnQName="retNS:FindContractDetailResponse"
xmlns:retNS="http://xmlns.myws.com/gco/doctypes/Contract/v1"
returnType="rtns:FindContractResponse"
xmlns:rtns="http://xmlns.myws.com/gco/doctypes/Contract/v1"
soapAction="http://xmlns.myws.com/gco/services/Contract/v1/FindContractPriceByCriteria"
>
        <parameter
qname="pns:FindContractDetailMatchCriteria"
xmlns:pns="http://xmlns.myws.com/gco/doctypes/Contract/v1"
type="tns:FindContractCriteria"
xmlns:tns="http://xmlns.myws.com/gco/doctypes/Contract/v1"/>
      </operation>
      <parameter name="allowedMethods"
value="findPriceByCriteria"/>
</service>

Service gets deployed successfully.

When I try to invoke the WS with the payload,

<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<FindContractDetailMatchCriteria
xmlns="http://xmlns.myws.com/gco/doctypes/Contract/v1">
<MatchCriteria SourceSystem="SAP"
CustomerNumber="836367"
xmlns="http://xmlns.myws.com/gco/datatypes/Contract/v1">
<MaterialNumber>0-01607-04</MaterialNumber>
<PriceDate>2007-05-14</ns1:PriceDate>
</MatchCriteria>
</FindContractDetailMatchCriteria>

It works fine.

But If I change the elements in the payload to use
prefixes like,

<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<FindContractDetailMatchCriteria
xmlns="http://xmlns.myws.com/gco/doctypes/Contract/v1">
	<ns1:MatchCriteria SourceSystem="SAP"
CustomerNumber="836367"
xmlns:ns1="http://xmlns.myws.com/gco/datatypes/Contract/v1">
		<ns1:MaterialNumber>0-01607-04</ns1:MaterialNumber>
		<ns1:PriceDate>2007-05-14</ns1:PriceDate>
	</ns1:MatchCriteria>
</FindContractDetailMatchCriteria>

I am getting the exception that says

org.xml.sax.SAXParseException: The value of the
attribute
"prefix="xmlns",localpart="ns1",rawname="xmlns:ns1""
is invalid. Prefixed namespace bindings may not be
empty.
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
	at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
	at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
	at
org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
	at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at
org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
	at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at
org.apache.axis.client.Call.invokeEngine(Call.java:2784)
	at org.apache.axis.client.Call.invoke(Call.java:2767)
	at org.apache.axis.client.Call.invoke(Call.java:1792)

Axis is expecting me to bind the prefixes in each and
every element. For example,

<ns1:MaterialNumber
xmlns:ns1="http://xmlns.myws.com/gco/datatypes/Contract/v1">0-01607-04</ns1:MaterialNumber>
<ns1:PriceDate
xmlns:ns1="http://xmlns.myws.com/gco/datatypes/Contract/v1">2007-05-14</ns1:PriceDate>

When I make this change, it work fine. But, there are
instances when the client will not bind the prefixes
in each and every element.

Is there a workaround of this issue? Or is there
something in axis that i can configure so that axis
picks up the binding for the parent element(s)?

I tried setting enableNamespacePrefixOptimization to
true. It didn't help.

Please help.

Thanks in advance.

Aspert


       
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis 1.4 : Prefixed namespace bindings may not be empty error in doc ws

Posted by Edison Aspert <as...@yahoo.com>.
Hello,

After furthur investigation I found that this is a
client side issue. Because the same webservice worked
fine when invoked from SAP XI.

Here is my client code:

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress("enpoint address here");
SOAPBodyElement[] input = new SOAPBodyElement[1];
input[0] = new SOAPBodyElement(payload);//Where
payload is a DOM Element.
call.invoke(input);

Thanks

aspert


 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org