users@jax-ws.java.net

Re: error: uniqueness constraint violation

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Wed, 05 Apr 2006 10:41:18 -0700

Yes, these error messages are really confusing and are carried forward
since jaxrpc time. It nedes good cleanup that would alow us to throw
appropriate and meaningful error message. I would be taking a shot at
these in rearch branch.

-vivek.

Jitendra Kotamraju wrote:
> Vivek,
>
> Is it possible to generate a better error message that include details
> about the entities that are not unique ?
>
> Jitu
>
> Vivek Pandey wrote:
>
>> The generated method parameters are named after wsdl:part_at_name. So
>> looking at your request and response messages:
>>
>> <message name="createInstanceRequest">
>> <part name="head" element="asap:Request"/>
>> <part name="body" element="asap:CreateInstanceRq"/>
>> </message>
>> <message name="createInstanceResponse">
>> <part name="head" element="asap:Response"/>
>> <part name="body" element="asap:CreateInstanceRs"/>
>> </message>
>>
>> The part names "boy" and "head" are same in request and response
>> however they reference different global elements. If they refer same
>> global element in that ase wsimport would generate a Holder. However
>> since thats not the case here so it complains.
>>
>> one option is to rename the parts in your wsdl for example:
>>
>> <message name="createInstanceRequest">
>> * <part name="requestHead" element="asap:Request"/>
>> * <part name="requestBody" element="asap:CreateInstanceRq"/>
>> </message>
>> <message name="createInstanceResponse">
>> <part name="head" element="asap:Response"/>
>> <part name="body" element="asap:CreateInstanceRs"/>
>> </message>
>>
>>
>> If you dont want to modify the wsdl the other option is to use
>> customization to rename the method parameters:
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>> <jaxws:bindings wsdlLocation="asap.wsdl"
>> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>>
>> <jaxws:bindings
>> node="wsdl:definitions/wsdl:portType[@name='FactoryPortType']/wsdl:operation[@name='CreateInstance']">
>>
>> <jaxws:parameter
>> part="wsdl:definitions/wsdl:message[@name='createInstanceRequest']/wsdl:part[@name='head']"
>> name="requestHead"/> <jaxws:parameter
>> part="wsdl:definitions/wsdl:message[@name='createInstanceRequest']/wsdl:part[@name='body']"
>> name="requestBody"/> </jaxws:bindings>
>> </jaxws:bindings>
>>
>> In this case you would feed this customization file to wsimport using
>> -b option.
>>
>> -vivek.
>> Michael Kaegi wrote:
>>
>>>
>>> Hi All
>>>
>>> I just start to play with JWSDP 2.0 (JAX-WS)
>>>
>>> I need help by following problem:
>>>
>>> I try to generate the "server" from wsdl...
>>>
>>>
>>> build.xml:
>>>
>>> <wsimport
>>> debug="true"
>>> keep="true" destdir="build/classes"
>>> wsdl="asap.wsdl">
>>> </wsimport>
>>>
>>>
>>> asap.wsdl:
>>>
>>> <?xml version="1.0"?>
>>> <definitions name="ASAP"
>>>
>>> targetNamespace="http://docs.oasis-open.org/asap/0.9/definitions"
>>> xmlns:asdl="http://docs.oasis-open.org/asap/0.9/definitions"
>>> xmlns:asap="http://www.oasis-open.org/asap/0.9/schemas"
>>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>> <import
>>> namespace="http://www.oasis-open.org/asap/0.9/schemas"
>>> location="asap2.wsdl"/>
>>> <!-- Messages =========== -->
>>> <message name="createInstanceRequest">
>>> <part name="head" element="asap:Request"/>
>>> <part name="body" element="asap:CreateInstanceRq"/>
>>> </message>
>>> <message name="createInstanceResponse">
>>> <part name="head" element="asap:Response"/>
>>> <part name="body" element="asap:CreateInstanceRs"/>
>>> </message>
>>> <!-- Port types ============== -->
>>> <portType name="FactoryPortType">
>>> <operation name="CreateInstance">
>>> <input message="asdl:createInstanceRequest"/>
>>> <output message="asdl:createInstanceResponse"/>
>>> </operation> </portType>
>>> <!-- Bindings ============== -->
>>> <binding name="AsapFactoryBinding"
>>> type="asdl:FactoryPortType">
>>> <soap:binding
>>> transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
>>> <operation name="CreateInstance">
>>> <soap:operation
>>>
>>> soapAction="http://www.oasis-open.org/asap/0.9/asap/factory/CreateInstance"/>
>>>
>>> <input message="asdl:createInstanceRequest">
>>> <soap:header message="asdl:createInstanceRequest"
>>> part="head" use="literal"/>
>>> <soap:body parts="body" use="literal"/>
>>> </input>
>>> <output message="asdl:createInstanceResponse">
>>> <soap:header message="asdl:createInstanceResponse"
>>> part="head" use="literal"/>
>>> <soap:body parts="body" use="literal"/>
>>> </output>
>>> </operation> </binding>
>>> <!-- Services ============== -->
>>> <service name="ASAPFactoryService">
>>> <port name="ASAPFactoryPort"
>>> binding="asdl:AsapFactoryBinding">
>>> <soap:address location="REPLACE_WITH_ACTUAL_URL" />
>>> </port>
>>> </service>
>>> </definitions>
>>>
>>>
>>> asap2.wsdl:
>>>
>>> <definitions name="ASAP2" xmlns="http://schemas.xmlsoap.org/wsdl/">
>>> <types>
>>> <schema
>>> targetNamespace="http://www.oasis-open.org/asap/0.9/schemas"
>>> xmlns="http://www.w3.org/2001/XMLSchema">
>>> <!-- headers ============ -->
>>> <element name="Request">
>>> <complexType>
>>> <sequence>
>>> <element
>>> name="SenderKey" type="string" minOccurs="1" />
>>> </sequence>
>>>
>>> </complexType> </element>
>>> <element name="Response">
>>> <complexType>
>>> <sequence>
>>> <element
>>> name="SenderKey" type="string" minOccurs="1" />
>>> </sequence>
>>>
>>> </complexType> </element>
>>> <!-- messages =================== -->
>>> <element
>>> name="CreateInstanceRq">
>>> <complexType>
>>> <sequence>
>>> <element name="Subject"
>>> type="string" minOccurs="1" />
>>> </sequence>
>>>
>>> </complexType>
>>> </element> <element
>>> name="CreateInstanceRs">
>>> <complexType>
>>> <sequence>
>>> <element name="InstanceKey" type="string" minOccurs="1"
>>> />
>>> </sequence> </complexType>
>>> </element>
>>> </schema> </types>
>>> </definitions>
>>> Unfortunately I get the following error: "uniqueness constraint
>>> violation"
>>>
>>> I try to isolate the problem and found out that if I uncomment
>>> following two lines...
>>>
>>> asap.wsdl (modified):
>>>
>>> <?xml version="1.0"?>
>>> <definitions name="ASAP"
>>>
>>> targetNamespace="http://docs.oasis-open.org/asap/0.9/definitions"
>>>
>>> xmlns:asdl="http://docs.oasis-open.org/asap/0.9/definitions"
>>>
>>> xmlns:asap="http://www.oasis-open.org/asap/0.9/schemas"
>>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>> <import
>>> namespace="http://www.oasis-open.org/asap/0.9/schemas"
>>> location="asap2.wsdl"/>
>>> <!-- Messages =========== -->
>>> <message name="createInstanceRequest">
>>> <part name="head" element="asap:Request"/>
>>> <part name="body" element="asap:CreateInstanceRq"/>
>>> </message>
>>> <message name="createInstanceResponse">
>>> <!--<part name="head" element="asap:Response"/>-->
>>> <part name="body" element="asap:CreateInstanceRs"/>
>>> </message>
>>> <!-- Port types ============== -->
>>> <portType name="FactoryPortType">
>>> <operation name="CreateInstance">
>>> <input message="asdl:createInstanceRequest"/>
>>> <output message="asdl:createInstanceResponse"/>
>>> </operation> </portType>
>>> <!-- Bindings ============== -->
>>> <binding name="AsapFactoryBinding"
>>> type="asdl:FactoryPortType">
>>> <soap:binding
>>> transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
>>> <operation name="CreateInstance">
>>> <soap:operation
>>>
>>> soapAction="http://www.oasis-open.org/asap/0.9/asap/factory/CreateInstance"/>
>>>
>>> <input message="asdl:createInstanceRequest">
>>> <soap:header message="asdl:createInstanceRequest"
>>> part="head" use="literal"/>
>>> <soap:body parts="body" use="literal"/>
>>> </input>
>>> <output message="asdl:createInstanceResponse">
>>> <!--<soap:header message="asdl:createInstanceResponse" part="head"
>>> use="literal"/>-->
>>> <soap:body parts="body" use="literal"/>
>>> </output>
>>> </operation> </binding>
>>> <!-- Services ============== -->
>>> <service name="ASAPFactoryService">
>>> <port name="ASAPFactoryPort"
>>> binding="asdl:AsapFactoryBinding">
>>> <soap:address location="REPLACE_WITH_ACTUAL_URL" />
>>> </port>
>>> </service>
>>> </definitions>
>>>
>>>
>>> ... It generates the server without an error. But I assume the
>>> server isn't complete.
>>>
>>> I have no idea how to solve this. Any help would be greate.
>>>
>>>
>>> Thanks
>>>
>>> brainware
>>> *
>>> Michael Kaegi*
>>>
>>>
>>> Tel: +41 41 748 22 00, Fax: +41 41 748 22 01, kam_at_brainware.ch
>>> <mailto:kam_at_brainware.ch>
>>> Brainware Solutions AG, Sumpfstrasse 15, CH-6300 Zug,
>>> www.brainware.ch <http://www.brainware.ch/>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.