Web services - jaxb binding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Web services - jaxb binding

Mansour
Hello all,
I am not advanced in web services, so bear with me.

I am trying to create a client to call some functions through
webservices. The web services in ofbiz use maps. For example, I am
trying to obtain a product by id. The web service response includes the
product as "eeval-Product". In the wsdl for this service,  I can see:

<xsd:element name="eeval-" type="tns:map-Map">
    <xsd:annotation>
        <xsd:documentation>
            The name of element need to be appended with name of entity such as eeval-Product for Product entity.
        </xsd:documentation>
    </xsd:annotation>
</xsd:element>

So here's what I did. I downloaded the wsdl and added appended the
entity name to this element. Then re-generated the client stub.

Now when a response is retireved it's obtained correctely, but the
binding doesn't work. For example, eeval-Product is a Map, but it's
null. Attributtes from this element are not bound, they are skipped by
the binding generated with wsdl2java with jaxb binding.

What would be the best way/tool to include the attributes from
"eeval-Product" into the map ?

Here's an exmaple response.

<?xml version="1.0"?>
<findProductByIdResponse xmlns="http://ofbiz.apache.org/service/">
    <map-Map>
        <map-Entry>
            <map-Key><std-String value="responseMessage"/></map-Key>
            <map-Value><std-String value="success"/></map-Value>
        </map-Entry>
        <map-Entry>
            <map-Key><std-String value="product"/></map-Key>
            <map-Value>
                <eeval-Product
                    billOfMaterialLevel="0" createdByUserLogin="admin" createdDate="2004-08-20 12:49:13.418"
                    createdStamp="2011-02-24 09:30:52.287" createdTxStamp="2011-02-24 09:30:52.186" description="Create your own pizza"
                    internalName="Pizza" isVariant="N" isVirtual="N" largeImageUrl="/images/products/PIZZA/large.png"
                    lastUpdatedStamp="2011-03-06 21:09:44.134" lastUpdatedTxStamp="2011-03-06 21:09:43.527" productId="PIZZA"
                    productName="Gold Pizza" productTypeId="AGGREGATED" smallImageUrl="/images/products/PIZZA/small.png"/>
            </map-Value>
        </map-Entry>
        <map-Entry>
            <map-Key><std-String value="productsList"/></map-Key>
            <map-Value><col-Collection/></map-Value>
        </map-Entry>
    </map-Map>
</findProductByIdResponse>


Any advice ?




Reply | Threaded
Open this post in threaded view
|

Re: Web services - jaxb binding

Alexander Graf
Hi,
I have the same Problem, ofbiz sends an answer, but it never appears in  
the holder.


             MapMap myMap = new MapMap();
             myMap.getMapEntry().add(mapEntry);
             myMap.getMapEntry().add(mapEntryLogin);
             myMap.getMapEntry().add(mapEntryPassword);


             Holder<MapMap> mapMap =
                     new Holder<MapMap>(myMap);



             port.findPartiesById(mapMap);

             for(MapEntry e : mapMap.value.getMapEntry()){
                 System.out.println(e.getMapKey() + " " + e.getMapValue());
             }

The code simply prints out the IN parameters, no out parameters, although  
the response was retrieved. (see attachment)


> So here's what I did. I downloaded the wsdl and added appended the
> entity name to this element. Then re-generated the client stub.

Is this what you did?

  <xsd:element name="eeval-Product" type="tns:map-Map">

I didn't do that, it makes no sense for me to rewrite the wsdl. Why isn't  
it generated with the entity name?

The part how to get the binding working is skipped in all tutorials. So  
here a second request: please tell us how. There are people who asked this  
years ago and never got an answer. Why? Isn't this an essential part of  
ofbiz? For me it is, because we want to use a Java SE client. I can not  
imagine that we are the first who want to do that.

Thanks in advance.
Alexander



Am 12.03.2011, 03:28 Uhr, schrieb Mansour Al Akeel  
<[hidden email]>:

> Hello all,
> I am not advanced in web services, so bear with me.
>
> I am trying to create a client to call some functions through
> webservices. The web services in ofbiz use maps. For example, I am
> trying to obtain a product by id. The web service response includes the
> product as "eeval-Product". In the wsdl for this service,  I can see:
>
> <xsd:element name="eeval-" type="tns:map-Map">
>     <xsd:annotation>
>         <xsd:documentation>
>             The name of element need to be appended with name of entity  
> such as eeval-Product for Product entity.
>         </xsd:documentation>
>     </xsd:annotation>
> </xsd:element>
>
> So here's what I did. I downloaded the wsdl and added appended the
> entity name to this element. Then re-generated the client stub.
>
> Now when a response is retireved it's obtained correctely, but the
> binding doesn't work. For example, eeval-Product is a Map, but it's
> null. Attributtes from this element are not bound, they are skipped by
> the binding generated with wsdl2java with jaxb binding.
>
> What would be the best way/tool to include the attributes from
> "eeval-Product" into the map ?
>
> Here's an exmaple response.
>
> <?xml version="1.0"?>
> <findProductByIdResponse xmlns="http://ofbiz.apache.org/service/">
>     <map-Map>
>         <map-Entry>
>             <map-Key><std-String value="responseMessage"/></map-Key>
>             <map-Value><std-String value="success"/></map-Value>
>         </map-Entry>
>         <map-Entry>
>             <map-Key><std-String value="product"/></map-Key>
>             <map-Value>
>                 <eeval-Product
>                     billOfMaterialLevel="0" createdByUserLogin="admin"  
> createdDate="2004-08-20 12:49:13.418"
>                     createdStamp="2011-02-24 09:30:52.287"  
> createdTxStamp="2011-02-24 09:30:52.186" description="Create your own  
> pizza"
>                     internalName="Pizza" isVariant="N" isVirtual="N"  
> largeImageUrl="/images/products/PIZZA/large.png"
>                     lastUpdatedStamp="2011-03-06 21:09:44.134"  
> lastUpdatedTxStamp="2011-03-06 21:09:43.527" productId="PIZZA"
>                     productName="Gold Pizza" productTypeId="AGGREGATED"  
> smallImageUrl="/images/products/PIZZA/small.png"/>
>             </map-Value>
>         </map-Entry>
>         <map-Entry>
>             <map-Key><std-String value="productsList"/></map-Key>
>             <map-Value><col-Collection/></map-Value>
>         </map-Entry>
>     </map-Map>
> </findProductByIdResponse>
>
>
> Any advice ?
>
>
>

tcp.txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Web services - jaxb binding

Alexander Graf
In reply to this post by Mansour
Okay I got something interesting:

http://synodinos.net/2007/08/02/web-services-interoperability-fable-with-java-and-php/

The author Dionysios G. Synodinos says, that "An ENVELOPE described with  
an rpc-literal binding MUST place the part accessor elements for  
parameters and return value in no namespace."

That means the response of ofbiz is ignored, because

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope  
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><findPartiesByIdResponse  
xmlns="http://ofbiz.apache.org/service/"><map-Map>

contains the namespace http://ofbiz.apache.org/service/

Let's play a bit and find out how to disable it. Maybe that's the reason  
for all the trouble.

Regards Alexander
Reply | Threaded
Open this post in threaded view
|

Re: Web services - jaxb binding

Jacques Le Roux-3
Interesting... Looking forward....

Jacques

From: "Alexander Graf" <[hidden email]>

> Okay I got something interesting:
>
> http://synodinos.net/2007/08/02/web-services-interoperability-fable-with-java-and-php/
>
> The author Dionysios G. Synodinos says, that "An ENVELOPE described with  
> an rpc-literal binding MUST place the part accessor elements for  
> parameters and return value in no namespace."
>
> That means the response of ofbiz is ignored, because
>
> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope  
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><findPartiesByIdResponse  
> xmlns="http://ofbiz.apache.org/service/"><map-Map>
>
> contains the namespace http://ofbiz.apache.org/service/
>
> Let's play a bit and find out how to disable it. Maybe that's the reason  
> for all the trouble.
>
> Regards Alexander
>

Reply | Threaded
Open this post in threaded view
|

Re: Web services - jaxb binding

Alexander Graf
Okay it is definitely not working. I commented out the lines:

OMAttribute defaultNS = factory.createOMAttribute("xmlns", null,  
ModelService.TNS);
resService.addAttribute(defaultNS);

in

org.ofbiz.webapp.event.SOAPEventHandler

and got a response without xmlns="http://ofbiz.apache.org/service/
but it is still not working. The response is not unmarshalled, seems to be  
ignored.

Any ideas? is there really nobody who uses jax-ws???



Am 16.03.2011, 08:43 Uhr, schrieb Jacques Le Roux <[hidden email]>:

> Interesting... Looking forward....
>
> Jacques
>
> From: "Alexander Graf" <[hidden email]>
>> Okay I got something interesting:
>>  
>> http://synodinos.net/2007/08/02/web-services-interoperability-fable-with-java-and-php/
>>  The author Dionysios G. Synodinos says, that "An ENVELOPE described  
>> with  an rpc-literal binding MUST place the part accessor elements for  
>> parameters and return value in no namespace."
>>  That means the response of ofbiz is ignored, because
>>  <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope  
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><findPartiesByIdResponse  
>> xmlns="http://ofbiz.apache.org/service/"><map-Map>
>>  contains the namespace http://ofbiz.apache.org/service/
>>  Let's play a bit and find out how to disable it. Maybe that's the  
>> reason  for all the trouble.
>>  Regards Alexander
>>