cancel
Showing results for 
Search instead for 
Did you mean: 

Sample webservice code

Former Member
0 Kudos

Hello,

I am trying to write a webservice to create a operation but it is really dificult by using the document we received with the SDK.

Can anyone share some webservice codes so it will easy for us to unterstand.

Also if there if there is any document related to the same please let me now.

Regards,

Pushkar

Accepted Solutions (1)

Accepted Solutions (1)

tim_drury
Active Participant
0 Kudos

This example simply wraps an existing ME public API method with a web service.

/people/tim.drury/blog/2011/01/28/creating-a-custom-sap-me-web-service-utilizing-sap-me-public-api

-tim

Former Member
0 Kudos

Hello Tim,

Got the WS deployed with below warning : did I go wrong somewhere? (It is working fine though )

1. File:C:\Documents and Settings\Administrator\workspace\MySAPMEWebServiceApp\MySAPMEWebServiceApp.ear

Name:MySAPMEWebServiceApp

Vendor:com.sap

Location:localhost

Version:2011.01.31.11.27.28

Deploy status:Warning

Version:NEW

Description:

1. Warning occurred on server 9791850 during deploy com.sap/MySAPMEWebServiceApp : Web Class Existence Test: The servlet "com.atos.sapme.production.AtosSapMEProductionService" must implement "javax.servlet.Servlet"., file: MySAPMEWebService.war#WEB-INF/web.xml, column 0, line 0, severity: warning

2. Warning exception has been returned while the [com.sap/MySAPMEWebServiceApp] was starting. Warnings:[

][

Warning occurred on server 9791850 during startApp com.sap/MySAPMEWebServiceApp : Application com.sap/MySAPMEWebServiceApp has a weak reference to resource com.atos.sapme.production.AtosSapMEProductionService/wsContext with type javax.xml.ws.WebServiceContext but the resource is not available and the application may not work correctly.

]

Result

Status:Warning

Regards,

Pushkar

Edited by: Pushkar Patil on Jan 31, 2011 4:03 PM

tim_drury
Active Participant
0 Kudos

Ignore this warning. NW 7.11 seems to not prefer JEE 5 web services created with POJOs using the @WebService annotation. However, it will create the web services and they will show up in SOA management in NWA.

Feel free to send the NW guys a CSS ticket on this...

-tim

Answers (3)

Answers (3)

former_member184795
Participant
0 Kudos

Hi Tim,

Thanks for the example on the blog, one question though.. You did this in NWDS and you mention eclipse a couple of times (mostly limitations and different steps required), I do have access to both tools, is there any reason why I would choose to use eclipse that came with the ME SDK download versus using NWDS?

Apologies if this is a dumb question in advance, fairly new to both tools, just ran in some problems trying to deploy the example web service illustrated in the blog using eclipse, so am hoping these will go away if I just follow the blog using NWDS.

Thanks,

Sean.

FYI, Error message below

Deploy Exception.ASJ.dpl_dc.001108 [ERROR CODE DPL.DC.3095] A reading error occurred while loading the SDU E:/usr/sap/MX1/J02/j2ee/cluster/server0/temp/tcbldeploy_controller/archives/182/mySAPMEWebServiceApp.ear.; nested exception is:

com.sap.engine.services.dc.util.readers.sdu_reader.SduReaderException: [ERROR CODE DPL.DC.3388]

The specified file E:/usr/sap/MX1/J02/j2ee/cluster/server0/temp/tcbldeploy_controller/archives/182/mySAPMEWebServiceApp.ear is not a valid SAP deployable unit. In case it is Java Enterprise application, please convert it to SAP compatible deloyable unit first.

tim_drury
Active Participant
0 Kudos

I chose to use both Eclipse and NWDS because I know our customers use both. Use whichever is more comfortable for you with the caveat that plain Eclipse doesn't have a NW 7.11 runtime so you have to either create your own or dowload the one indicated in the blog and modify it to include the annotations jar.

When you exported the application did you choose "SAP EAR"? This will ensure the EAR includes some SAP descriptor files in META-INF directory.

Also, how are you deploying the EAR? Via the deployment perspective in Eclipse, telnet, JSPM? I didn't test with JSPM but it should deploy with telnet or the deployment perspective in Eclipse/NWDS.

-tim

Former Member
0 Kudos

Hi Sean,

Specifically for web service development, as described in Tim's blog, NWDS has some advantages over SDK's eclipse or regular Eclipse:

1. NWDS supports NW web services development out of the box

2. NWDS has all NW libraries built in

3. NWDS creates EAR with all required NW specific descriptors

4. NWDS is integrated with NWDI for source control and build automation

5. NWDS is integrated with NW server for deployment/undeployment

6. NWDS hasn't predefined set of projects as SDK's eclipse has

7. If you create a web service in SDK it is packages within SAP ME EAR, in NWDS (or Eclipse) you get separate EAR. It significantly improves deployment time, cause you don't have to redeploy ME application every time you make a change in web service

Thanks

Ivan

former_member184795
Participant
0 Kudos

Thanks Tim & Ivan, I guess as I want to use the pre-defined set of projects that I imported using in eclipse, so I want to get this working in the SDK elipse based tool for now. So I need some basic help, I need more details or an example via eclipse per the following stmt. Right now I right click on the ear file and pick deploy and get the error message, so I realise I missing one or more steps.

"Via the deployment perspective in Eclipse, telnet, JSPM? I didn't test with JSPM but it should deploy with telnet or the deployment perspective in Eclipse/NWDS."

tim_drury
Active Participant
0 Kudos

Eclipse doesn't know how to deploy to NetWeaver without additional plugins. We have the NWDS tools extracted and installed in Eclipse and I thought there was a download on SDN for it, but I can't find it now. I'll keep looking. In the meantime, you can try out this NW plugin for eclipse:

http://sourceforge.net/apps/trac/sapnweclipse/wiki/InstallDeployWSApp

We also use telnet (https://cw.sdn.sap.com/cw/docs/DOC-104194). Some guys have a VBS script to deploy/undeploy apps via the textconsole tool in j2ee/console, but I can't find any help on it.

-tim

tim_drury
Active Participant
0 Kudos

Pushkar, the blog entry still hasn't been approved by the moderators. I've sent them an email and I've asked to become a moderator to help them out, but there must be a backlog. I'm checking every hour or so and I promise to update this thread as soon as the blog entry is approved and becomes public.

Sorry for the delay.

-tim

tim_drury
Active Participant
0 Kudos

Pushkar, we're formalizing the documentation now. I have an informal (and unofficial) way of creating ME web services in Eclipse or NWDS and I've published this as a blog on SCN yesterday. I'm waiting for the moderators to approve it then I'll post the link to it here.

-tim