Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Creating Top Down webservices in Document/literal style (newbie)
Creating Top Down webservices in Document/literal style (newbie) [message #168288] Tue, 02 May 2006 09:26 Go to next message
Eclipse UserFriend
Originally posted by: Ben_Engbers.yahoo.com

Hi,

Nearly all the manuals or tutorials I found, concentrate on how to write
a webservice client for RPC/encoded services but it is very difficult to
find information on how to write a webservice server using
document/literal style and that's what I need to write (The service
should return an array of documents which contains subarrays. As far as
I know this can only be done using document/literal style).

It was rather easy to create the WSDL-file and analogous to the
"Creating Top Down Web Service" by Kathy Chan, I generated a webservice.

After filling up the generated SOAPImpl with dummy values, I launched
the Web Services Explorer and tried to test the service.

public class CertificaatSOAPImpl implements
nl.minlnv.client.Certificaat.Certificaat_PortType{
public nl.minlnv.client.Certificaat.CertificaatLijstResponse
certificaatLijst(nl.minlnv.client.Certificaat.CertificaatLij stDigiDRequest
certificaatLijstDigiDRequest) throws java.rmi.RemoteException {
TCertificaat certificaat = new TCertificaat();
certificaat.setCertNo(1234);
certificaat.setConsigner("Ben");
certificaat.setBotanicalName("Rosa");
certificaat.setBedrijfsobject(new TBedrijfsComplex [] { new
TBedrijfsComplex("kas1"), new TBedrijfsComplex("kas2")});

ArrayOf_tCertificaat certificaatLijst = new ArrayOf_tCertificaat(
new TCertificaat [] {certificaat});
CertificaatLijstResponse retour = new
CertificaatLijstResponse(certificaatLijst);
return retour;
}

The Services Explorer loads the service succesfully but after invoking
it, it returns with
IWAB0135E An unexpected error has occurred.
302
Found

I then continued with the tutorial on consuming a webservice.
After generating a web service client and testing it with "Web Services
Test Client", the same service now returns with "certificaatLijstResult:
nl.minlnv.client.Certificaat.ArrayOf_tCertificaat@8c3a95".
The TCP/IP monitor shows the desired result:
certificaatLijstResult: <?xml version="1.0"
encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CertificaatLijstResponse
xmlns="http://client.minlnv.nl/Certificaat/"><CertificaatLijstResult
xmlns="">
<tCertificaat>
<CertNo>1234</CertNo>
<Consigner>Ben</Consigner>
<Bedrijfsobject><ObjectNaam>kas1</ObjectNaam></Bedrijfsobject >
<Bedrijfsobject><ObjectNaam>kas2</ObjectNaam></Bedrijfsobject >
<BotanicalName>Rosa</BotanicalName>
</tCertificaat>
</CertificaatLijstResult>
</CertificaatLijstResponse>
</soapenv:Body>
</soapenv:Envelope>

Questions:
How comes that the Web Services Explorer can't return a result (How
should I interpret the errormessage)?
Where can I find tutorials on how to write document/literal style
webservices? Are there Eclipse/WTP-specific tutorials?
After generating a from service from a WSDL-file, a lot of classes are
generated (PortType, Service, ServiceLocator, Request, Response,
SOAPImpl, SOAPSkeleton and SOAPStub). Are there, apart from the
SOAPImpl, any other files which need to be edited?

Thanks,
Ben
Re: Creating Top Down webservices in Document/literal style (newbie) [message #168395 is a reply to message #168288] Wed, 03 May 2006 15:43 Go to previous messageGo to next message
Fabio Da Soghe is currently offline Fabio Da SogheFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Ben.

I've just experienced similar frustrations like yours. Maybe you can
find useful some little considerations.

1) When you use the top-down wizard, starting from a WSDL file, you get
the Java classes and a "live" WSDL file, in the WebContent/WSDL folder.
It's this file that Axis puts in execution.

2) In order to get your web service up and running, you have to tell it
to Axis. You can achieve this in two way: manually or having the WTP
install it for you.

3) Manual install in Axis requires you to use the Axis Admin client, as
specified in the deploy.wsdd file you get when using the top-down
wizard. It's not my preferred way ;-)

4) Automatic install is achieved with the same top-down wizard: you have
to check the "Start the web service in web project" flag. This makes the
WTP create a server-config.wsdd file in your WebContent/WEB-INF folder.
This file is used by Axis to deploy the web service.

5) I think you have to care about the service URL in order to get it
correctly addressed by the web service explorer. I configured the URL in
the WSDL file, in the <soap:address> element (I put "http:localhost").

There is what appears to me a bug (if I would get some feedback about
this from someone more expert then me on the WTP I would appreciate very
much): when you execute the wizard for the first time, the web service
doesn't seem to be correctly deployed because the server-config.wsdd is
created AFTER Axis come up (infact it complaints about a missing
server-config.wsdd). If I restart Tomcat, all works fine.

Another open issue for me is about the re-execution of the top-down
wizard: the SomeServiceSOAPimpl class gets overwritten every time, even
when I've already modified it! By now I cannot find a suitable solution:
how can I write my implementation and update my web service definition
without losing my changes? To pretend to write the first time the right
and complete implementation of every web service defined by a WSDL file
isn't realistic, IMHO.

Hope this helps.

Cheers,

Fabio Da Soghe

Ben Engbers ha scritto:
> Hi,
>
> Nearly all the manuals or tutorials I found, concentrate on how to write
> a webservice client for RPC/encoded services but it is very difficult to
> find information on how to write a webservice server using
> document/literal style and that's what I need to write (The service
> should return an array of documents which contains subarrays. As far as
> I know this can only be done using document/literal style).
>
> It was rather easy to create the WSDL-file and analogous to the
> "Creating Top Down Web Service" by Kathy Chan, I generated a webservice.
>
> After filling up the generated SOAPImpl with dummy values, I launched
> the Web Services Explorer and tried to test the service.
>
> public class CertificaatSOAPImpl implements
> nl.minlnv.client.Certificaat.Certificaat_PortType{
> public nl.minlnv.client.Certificaat.CertificaatLijstResponse
> certificaatLijst(nl.minlnv.client.Certificaat.CertificaatLij stDigiDRequest
> certificaatLijstDigiDRequest) throws java.rmi.RemoteException {
> TCertificaat certificaat = new TCertificaat();
> certificaat.setCertNo(1234);
> certificaat.setConsigner("Ben");
> certificaat.setBotanicalName("Rosa");
> certificaat.setBedrijfsobject(new TBedrijfsComplex [] { new
> TBedrijfsComplex("kas1"), new TBedrijfsComplex("kas2")});
>
> ArrayOf_tCertificaat certificaatLijst = new ArrayOf_tCertificaat(
> new TCertificaat [] {certificaat});
> CertificaatLijstResponse retour = new
> CertificaatLijstResponse(certificaatLijst);
> return retour;
> }
>
> The Services Explorer loads the service succesfully but after invoking
> it, it returns with
> IWAB0135E An unexpected error has occurred.
> 302
> Found
>
> I then continued with the tutorial on consuming a webservice.
> After generating a web service client and testing it with "Web Services
> Test Client", the same service now returns with "certificaatLijstResult:
> nl.minlnv.client.Certificaat.ArrayOf_tCertificaat@8c3a95".
> The TCP/IP monitor shows the desired result:
> certificaatLijstResult: <?xml version="1.0"
> encoding="utf-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CertificaatLijstResponse
> xmlns="http://client.minlnv.nl/Certificaat/"><CertificaatLijstResult
> xmlns="">
> <tCertificaat>
> <CertNo>1234</CertNo>
> <Consigner>Ben</Consigner>
> <Bedrijfsobject><ObjectNaam>kas1</ObjectNaam></Bedrijfsobject >
> <Bedrijfsobject><ObjectNaam>kas2</ObjectNaam></Bedrijfsobject >
> <BotanicalName>Rosa</BotanicalName>
> </tCertificaat>
> </CertificaatLijstResult>
> </CertificaatLijstResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Questions:
> How comes that the Web Services Explorer can't return a result (How
> should I interpret the errormessage)?
> Where can I find tutorials on how to write document/literal style
> webservices? Are there Eclipse/WTP-specific tutorials?
> After generating a from service from a WSDL-file, a lot of classes are
> generated (PortType, Service, ServiceLocator, Request, Response,
> SOAPImpl, SOAPSkeleton and SOAPStub). Are there, apart from the
> SOAPImpl, any other files which need to be edited?
>
> Thanks,
> Ben
Re: Creating Top Down webservices in Document/literal style (newbie) [message #168413 is a reply to message #168395] Wed, 03 May 2006 16:33 Go to previous messageGo to next message
Fabio Da Soghe is currently offline Fabio Da SogheFriend
Messages: 20
Registered: July 2009
Junior Member
I forgot: when testing the web service with the Web Service Explorer,
you have to select the WebContent/wsdl/SomeServiceSOAP.wsdl file, not
the original one.

Fabio

Fabio Da Soghe ha scritto:
> Hi Ben.
>
> I've just experienced similar frustrations like yours. Maybe you can
> find useful some little considerations.
>
> 1) When you use the top-down wizard, starting from a WSDL file, you get
> the Java classes and a "live" WSDL file, in the WebContent/WSDL folder.
> It's this file that Axis puts in execution.
>
> 2) In order to get your web service up and running, you have to tell it
> to Axis. You can achieve this in two way: manually or having the WTP
> install it for you.
>
> 3) Manual install in Axis requires you to use the Axis Admin client, as
> specified in the deploy.wsdd file you get when using the top-down
> wizard. It's not my preferred way ;-)
>
> 4) Automatic install is achieved with the same top-down wizard: you have
> to check the "Start the web service in web project" flag. This makes the
> WTP create a server-config.wsdd file in your WebContent/WEB-INF folder.
> This file is used by Axis to deploy the web service.
>
> 5) I think you have to care about the service URL in order to get it
> correctly addressed by the web service explorer. I configured the URL in
> the WSDL file, in the <soap:address> element (I put "http:localhost").
>
> There is what appears to me a bug (if I would get some feedback about
> this from someone more expert then me on the WTP I would appreciate very
> much): when you execute the wizard for the first time, the web service
> doesn't seem to be correctly deployed because the server-config.wsdd is
> created AFTER Axis come up (infact it complaints about a missing
> server-config.wsdd). If I restart Tomcat, all works fine.
>
> Another open issue for me is about the re-execution of the top-down
> wizard: the SomeServiceSOAPimpl class gets overwritten every time, even
> when I've already modified it! By now I cannot find a suitable solution:
> how can I write my implementation and update my web service definition
> without losing my changes? To pretend to write the first time the right
> and complete implementation of every web service defined by a WSDL file
> isn't realistic, IMHO.
>
> Hope this helps.
>
> Cheers,
>
> Fabio Da Soghe
>
> Ben Engbers ha scritto:
>> Hi,
>>
>> Nearly all the manuals or tutorials I found, concentrate on how to
>> write a webservice client for RPC/encoded services but it is very
>> difficult to find information on how to write a webservice server
>> using document/literal style and that's what I need to write (The
>> service should return an array of documents which contains subarrays.
>> As far as I know this can only be done using document/literal style).
>>
>> It was rather easy to create the WSDL-file and analogous to the
>> "Creating Top Down Web Service" by Kathy Chan, I generated a webservice.
>>
>> After filling up the generated SOAPImpl with dummy values, I launched
>> the Web Services Explorer and tried to test the service.
>>
>> public class CertificaatSOAPImpl implements
>> nl.minlnv.client.Certificaat.Certificaat_PortType{
>> public nl.minlnv.client.Certificaat.CertificaatLijstResponse
>> certificaatLijst(nl.minlnv.client.Certificaat.CertificaatLij stDigiDRequest
>> certificaatLijstDigiDRequest) throws java.rmi.RemoteException {
>> TCertificaat certificaat = new TCertificaat();
>> certificaat.setCertNo(1234);
>> certificaat.setConsigner("Ben");
>> certificaat.setBotanicalName("Rosa");
>> certificaat.setBedrijfsobject(new TBedrijfsComplex [] { new
>> TBedrijfsComplex("kas1"), new TBedrijfsComplex("kas2")});
>>
>> ArrayOf_tCertificaat certificaatLijst = new
>> ArrayOf_tCertificaat( new TCertificaat [] {certificaat});
>> CertificaatLijstResponse retour = new
>> CertificaatLijstResponse(certificaatLijst);
>> return retour;
>> }
>>
>> The Services Explorer loads the service succesfully but after invoking
>> it, it returns with
>> IWAB0135E An unexpected error has occurred.
>> 302
>> Found
>>
>> I then continued with the tutorial on consuming a webservice.
>> After generating a web service client and testing it with "Web
>> Services Test Client", the same service now returns with
>> "certificaatLijstResult:
>> nl.minlnv.client.Certificaat.ArrayOf_tCertificaat@8c3a95".
>> The TCP/IP monitor shows the desired result:
>> certificaatLijstResult: <?xml version="1.0"
>> encoding="utf-8"?><soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CertificaatLijstResponse
>> xmlns="http://client.minlnv.nl/Certificaat/"><CertificaatLijstResult
>> xmlns="">
>> <tCertificaat>
>> <CertNo>1234</CertNo>
>> <Consigner>Ben</Consigner>
>> <Bedrijfsobject><ObjectNaam>kas1</ObjectNaam></Bedrijfsobject >
>> <Bedrijfsobject><ObjectNaam>kas2</ObjectNaam></Bedrijfsobject >
>> <BotanicalName>Rosa</BotanicalName>
>> </tCertificaat>
>> </CertificaatLijstResult>
>> </CertificaatLijstResponse>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> Questions:
>> How comes that the Web Services Explorer can't return a result (How
>> should I interpret the errormessage)?
>> Where can I find tutorials on how to write document/literal style
>> webservices? Are there Eclipse/WTP-specific tutorials?
>> After generating a from service from a WSDL-file, a lot of classes are
>> generated (PortType, Service, ServiceLocator, Request, Response,
>> SOAPImpl, SOAPSkeleton and SOAPStub). Are there, apart from the
>> SOAPImpl, any other files which need to be edited?
>>
>> Thanks,
>> Ben
Re: Creating Top Down webservices in Document/literal style (newbie) [message #168892 is a reply to message #168395] Wed, 10 May 2006 08:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Ben_Engbers.yahoo.com

Fabio Da Soghe wrote:
> Hi Ben.
>
> I've just experienced similar frustrations like yours. Maybe you can
> find useful some little considerations.
>
> 1) When you use the top-down wizard, starting from a WSDL file, you get
> the Java classes and a "live" WSDL file, in the WebContent/WSDL folder.
> It's this file that Axis puts in execution.
>
> 2) In order to get your web service up and running, you have to tell it
> to Axis. You can achieve this in two way: manually or having the WTP
> install it for you.
>
> 3) Manual install in Axis requires you to use the Axis Admin client, as
> specified in the deploy.wsdd file you get when using the top-down
> wizard. It's not my preferred way ;-)
>
> 4) Automatic install is achieved with the same top-down wizard: you have
> to check the "Start the web service in web project" flag. This makes the
> WTP create a server-config.wsdd file in your WebContent/WEB-INF folder.
> This file is used by Axis to deploy the web service.
>
> 5) I think you have to care about the service URL in order to get it
> correctly addressed by the web service explorer. I configured the URL in
> the WSDL file, in the <soap:address> element (I put "http:localhost").

I didn't know that it was possible to perform an automatic install. What
I did was 1) manually modify the soap:address 2) export the webservice
as a war and 3) automatically deploy the war in Tomcat.
I'll also try it your way.

> There is what appears to me a bug (if I would get some feedback about
> this from someone more expert then me on the WTP I would appreciate very
> much): when you execute the wizard for the first time, the web service
> doesn't seem to be correctly deployed because the server-config.wsdd is
> created AFTER Axis come up (infact it complaints about a missing
> server-config.wsdd). If I restart Tomcat, all works fine.
>
> Another open issue for me is about the re-execution of the top-down
> wizard: the SomeServiceSOAPimpl class gets overwritten every time, even
> when I've already modified it! By now I cannot find a suitable solution:
> how can I write my implementation and update my web service definition
> without losing my changes? To pretend to write the first time the right
> and complete implementation of every web service defined by a WSDL file
> isn't realistic, IMHO.
I agree. Working with SOA may be the future but learning how to write
services gives me a headache :-)

Ben
Re: Creating Top Down webservices in Document/literal style (newbie) [message #171905 is a reply to message #168288] Wed, 21 June 2006 16:40 Go to previous message
Chris Brealey is currently offline Chris BrealeyFriend
Messages: 104
Registered: July 2009
Senior Member
Ben,
the Web Services Explorer should provide a better error message, but moreover, it should process
the response correctly (provided it complies with the WSDL/Schema). It may be tripping over the
HTTP 302 response. Please consider opening a bug against WTP's wst.ws component, and attach the
WSDL if possible. Also, in the top right corner of the results frame of the WSE, check for a
"Source" link. If a well-formed XML SOAP message of any sort came back from the service, then you
should be able to click on this link to examine the response as raw XML.

The top-down tutorial is based on document/literal WSDL [1]. Are you looking for information on
how to hand-craft a doc/lit WSDL document using the WSDL editor, and/or for guidance on how to
design the schema used by your WSDL?

Unfortunately JAX-RPC and the typical implementations of it do generate alot of Java noise for
Web services (top-down) and clients. Most of the Java code is so-called deployment code and
should be ignored. In top-down, the only class you need to edit is the "Impl" class. Note that as
of WTP 1.5 we no longer stomp on the Impl class each time you regen. Instead, we merge the newly
generated Impl class with the existing one in the workspace.

Cheers - CB.

[1]
http://www.eclipse.org/webtools/community/tutorials/TopDownW ebService/srcfiles/AreaService.wsdl

Ben Engbers wrote:

> Hi,
>
> Nearly all the manuals or tutorials I found, concentrate on how to write
> a webservice client for RPC/encoded services but it is very difficult to
> find information on how to write a webservice server using
> document/literal style and that's what I need to write (The service
> should return an array of documents which contains subarrays. As far as
> I know this can only be done using document/literal style).
>
> It was rather easy to create the WSDL-file and analogous to the
> "Creating Top Down Web Service" by Kathy Chan, I generated a webservice.
>
> After filling up the generated SOAPImpl with dummy values, I launched
> the Web Services Explorer and tried to test the service.
>
> public class CertificaatSOAPImpl implements
> nl.minlnv.client.Certificaat.Certificaat_PortType{
> public nl.minlnv.client.Certificaat.CertificaatLijstResponse
> certificaatLijst(nl.minlnv.client.Certificaat.CertificaatLij stDigiDRequest
> certificaatLijstDigiDRequest) throws java.rmi.RemoteException {
> TCertificaat certificaat = new TCertificaat();
> certificaat.setCertNo(1234);
> certificaat.setConsigner("Ben");
> certificaat.setBotanicalName("Rosa");
> certificaat.setBedrijfsobject(new TBedrijfsComplex [] { new
> TBedrijfsComplex("kas1"), new TBedrijfsComplex("kas2")});
>
> ArrayOf_tCertificaat certificaatLijst = new ArrayOf_tCertificaat(
> new TCertificaat [] {certificaat});
> CertificaatLijstResponse retour = new
> CertificaatLijstResponse(certificaatLijst);
> return retour;
> }
>
> The Services Explorer loads the service succesfully but after invoking
> it, it returns with
> IWAB0135E An unexpected error has occurred.
> 302
> Found
>
> I then continued with the tutorial on consuming a webservice.
> After generating a web service client and testing it with "Web Services
> Test Client", the same service now returns with "certificaatLijstResult:
> nl.minlnv.client.Certificaat.ArrayOf_tCertificaat@8c3a95".
> The TCP/IP monitor shows the desired result:
> certificaatLijstResult: <?xml version="1.0"
> encoding="utf-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CertificaatLijstResponse
> xmlns="http://client.minlnv.nl/Certificaat/"><CertificaatLijstResult
> xmlns="">
> <tCertificaat>
> <CertNo>1234</CertNo>
> <Consigner>Ben</Consigner>
> <Bedrijfsobject><ObjectNaam>kas1</ObjectNaam></Bedrijfsobject >
> <Bedrijfsobject><ObjectNaam>kas2</ObjectNaam></Bedrijfsobject >
> <BotanicalName>Rosa</BotanicalName>
> </tCertificaat>
> </CertificaatLijstResult>
> </CertificaatLijstResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Questions:
> How comes that the Web Services Explorer can't return a result (How
> should I interpret the errormessage)?
> Where can I find tutorials on how to write document/literal style
> webservices? Are there Eclipse/WTP-specific tutorials?
> After generating a from service from a WSDL-file, a lot of classes are
> generated (PortType, Service, ServiceLocator, Request, Response,
> SOAPImpl, SOAPSkeleton and SOAPStub). Are there, apart from the
> SOAPImpl, any other files which need to be edited?
>
> Thanks,
> Ben
Previous Topic:Generate Web Service Proxy...
Next Topic:Stand alone client file for Web services
Goto Forum:
  


Current Time: Mon Dec 22 22:11:29 GMT 2014

Powered by FUDForum. Page generated in 0.09505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software