• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Methods other then getters and setters in object (java bean)in webservices

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kyle,
I am using WSAD 5.1.1 and server 5.0.2.5 (w/ fix pack).I have a session bean exposed as a web service using Doc/Lit and it returns a result object to the consumer. In the java bean defining the custom result object can I have any method other then getters and setters whose name starts with something other then get/set ? If yes then what do I need to do so that .net client(created from the wsdl instance) can recognise the method? My first quick try at this revealed negative results...Please advise.

Thanks for your time.
K
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you can't have a "real method". WSDL has no way of representing methods for parameters (only data). It just won't work. Sorry.

Kyle
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kyle.Your reply reduces the efforts on my side by a lot...But now,if you dont mind I need to confirm one more thing..Is it possible to adopt Adapter Pattern for the above said scenario?..Will I be able to generate the schema for interface correctly in wsdl and will the .NET client be able to interpret it corectly? or the best I can do is expose ALL the getters/setters in the object?..As usual my quick try gives negative results,I mean wsdl can not generate correct schema....

Thanks for your time.
Kuldeep
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Kyle,
Skipped your attention seems.Please help out,cause I am having hard times..... ...
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kuldeep -- I'm not sure what you mean by applying the Adapter pattern here -- I don't see how that would help. Can you give an example of what you're trying to do (seeing WSDL would help)?

Kyle
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure.

The wsld is as below...testOrder is of type TestOrder which extends Order and implements TestOrderIF interface.In the sessionbean I have a method placeOrder which excepts TestOrderIF and returns TestOrderIF (I have doubts about the validity of this operation.But being on the dumb side of the intellectual world I did it anyways..Can we trade interfaces like that?)...The only reason I think I am doing this is to restrict the client access to the methods in the objects.
---------------------------------------------------------------------------
WSDL
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions targetNamespace="http://sb.example.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sb.example.com" xmlns:intf="http://sb.example.com" xmlns:tns2="http://vo.example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://sb.example.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sb.example.com" xmlns:intf="http://sb.example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<element name="placeOrder">
<complexType>
<sequence>
<element name="testOrder" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
</element>
<element name="placeOrderResponse">
<complexType>
<sequence>
<element name="placeOrderReturn" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="placeOrderRequest">
<wsdl art element="intf laceOrder" name="parameters"/>
</wsdl:message>
<wsdl:message name="placeOrderResponse">
<wsdl art element="intf laceOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl ortType name="Test">
<wsdl peration name="placeOrder">
<wsdl:input message="intf laceOrderRequest" name="placeOrderRequest"/>
<wsdl utput message="intf laceOrderResponse" name="placeOrderResponse"/>
</wsdl peration>
</wsdl ortType>
<wsdl:binding name="TestSoapBinding" type="intf:Test">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl peration name="placeOrder">
<wsdlsoap peration soapAction=""/>
<wsdl:input name="placeOrderRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl utput name="placeOrderResponse">
<wsdlsoap:body use="literal"/>
</wsdl utput>
</wsdl peration>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl ort binding="intf:TestSoapBinding" name="Test">
<wsdlsoap:address location="http://localhost:9105/TestRouter/services/Test"/>
</wsdl ort>
</wsdl:service>
</wsdl efinitions>

---------------------------------------------------------------------------
Simple Method Call
---------------------------------------------------------------------------
public TestOrderIF placeOrder(TestOrderIF testOrder)
{
System.out.println("Test Field1 : " + testOrder.getTestField1());
System.out.println("Test Field2 : " + testOrder.getTestField2());

testOrder.setTestField1("Some String");
testOrder.setTestField2("Some String");
testOrder.setTestField3("Some String");

return testOrder;
}
---------------------------------------------------------------------------

funny thing is, in wsdl it nowhere mentions nothing like interface and the client(sample jsps) generated by websphere is kind of weird..It has input fields for package,specification vendor,specification date etc etc...Please help.

Thank you.
Kuldeep
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh here it is again...did not post properly the first time...

<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions targetNamespace="http://sb.example.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sb.example.com" xmlns:intf="http://sb.example.com" xmlns:tns2="http://vo.example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" <br /> targetNamespace="http://sb.example.com" <br /> xmlns="http://www.w3.org/2001/XMLSchema" <br /> xmlns:apachesoap="http://xml.apache.org/xml-soap" <br /> xmlns:impl="http://sb.example.com" <br /> xmlns:intf="http://sb.example.com" <br /> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<element name="placeOrder">
<complexType>
<sequence>
<element name="testOrder" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
</element>
<element name="placeOrderResponse">
<complexType>
<sequence>
<element name="placeOrderReturn" nillable="true" type="xsd:anyType"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>

<wsdl:message name="placeOrderRequest">
<wsdl art element="intf: placeOrder" name="parameters"/>
</wsdl:message>
<wsdl:message name="placeOrderResponse">
<wsdl art element="intf: placeOrderResponse" name="parameters"/>
</wsdl:message>
<wsdl ortType name="Test">
<wsdl peration name="placeOrder">
<wsdl:input message="intf: placeOrderRequest" <br /> name="placeOrderRequest"/>
<wsdl utput message="intf: placeOrderResponse" <br /> name="placeOrderResponse"/>
</wsdl peration>
</wsdl ortType>
<wsdl:binding name="TestSoapBinding" type="intf:Test">
<wsdlsoap:binding style="document" <br /> transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl peration name="placeOrder">
<wsdlsoap peration soapAction=""/>
<wsdl:input name="placeOrderRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl utput name="placeOrderResponse">
<wsdlsoap:body use="literal"/>
</wsdl utput>
</wsdl peration>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl ort binding="intf:TestSoapBinding" name="Test">
<wsdlsoap:address <br /> location="http://localhost:9105/TestRouter/services/Test"/>
</wsdl ort>
</wsdl:service>
</wsdl efinitions>
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
huh..is there any other way I can send or post this??
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, now I see your problem. No, you can't do this. You shouldn't try to generate a Web Service on an object that either returns or takes as a parameter an interface. The WebSphere Java2WSDL generator is doing its best to make sense of this, but in general, this is a really bad idea.

A general discussion on this subject can be found
in this article .

Kyle
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allright Kyle.On your word I should stop trying more to get this work and send the data objects back and forth.Thanks for all your help.I really appreciate it.
Kuldeep
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic