How to create web service for a Java class in SAP NetWeaver Studio
hi all,
i am using SAP Netweaver Developer Studio.have created a normal java project and i want to create web service for one of the classes in this project. i used the Web Service Creation Wizard to create a web service for this class. but it says there's no methods available for VI. all my methods in this class are public, what should i do?
Hi,
I guess there are other ways. But this is an easy way, if you find the right wizards.
Besides this it is good practise to define interface methods so that session bean implement these interface methods, and thus seperate the interface from the implementation.
In this approach you will need 3 projects:
An enterprise application project (will contain EJB Module)
An EJB Module project (will contain session bean)
A Java project (contains code that implements the session bean methods)
In my previous post I suggested to use a J2EE web mudule project. This was a mistake, it should be EJB module.
But it should be possible to do it in another way. It is up to you.
Good luck, Roelof
Similar Messages
-
How to create web service for database application
Hi everyone
Is it possible to create a web service for an apex database application page which has reports and radio fields and dialog boxes and validations in it. IF it is possible to create, pls help me with example or step by step procedure. I have seen all oracle docs of implementation of Web services in apex but unable to figure out how to get that link of wsdl for an application.
Thanks in advance.
Regards
Sandeep ArthamHi,
I guess there are other ways. But this is an easy way, if you find the right wizards.
Besides this it is good practise to define interface methods so that session bean implement these interface methods, and thus seperate the interface from the implementation.
In this approach you will need 3 projects:
An enterprise application project (will contain EJB Module)
An EJB Module project (will contain session bean)
A Java project (contains code that implements the session bean methods)
In my previous post I suggested to use a J2EE web mudule project. This was a mistake, it should be EJB module.
But it should be possible to do it in another way. It is up to you.
Good luck, Roelof -
How to creat web service for a function module?
who can provide me some resource on the topic.
thanks
Johnney.Hi John,
http://help.sap.com/saphelp_nw04/helpdata/en/e9/ae1b9a5d2cef4ea4b579f19d902871/content.htm
Reward Points if Useful
All the Best
Gokul -
Issue in creating web service for a ABAP Function Module
Hi,
now i'm learning how to create web service for a ABAP Function Module. I used the following steps.
1. select the Function Module, named "zws_test".
2. in the context menu, select "create->proxy object". so we enter into wizard.
3. in the wizard, press the radio button "Service Provider".
4. in the next page, press the radio button "Existing ABAP Objects(Inside Out)".
5. In the next page, Enter the "zws_test_prvider" as Service Definition and select "Function Module" as Endpoint Type.
6. in the next page, enter "zws_test" as Function Module and mark the "Mapping der Namen" button
7. in the next page,select "PRF_DT_IF_SEC_LOW" as Profile and mark "Deploy Service".
8. Save in the local package.
9. then it will pop up a window with title "WSDL Source". i selected "URL/HTTP Destination" and press "OK".
10.in the next page, i enter the URL as "http://hostname:portnumber/", and press "OK".
11. then it will pop up a window with title "Display logs". A record with error message "HTTP error(return code 404, message "Not found")" appears.
12. i press "ok" and a service provider with name "zws_test_prvider" appears in my local package.
13. i use "zws_test_prvider"'s URL to create a service consumer "ZCO_WS_TEST_CONSUMER" and logic portal "LP1".
14. But when i test my service consumer "ZCO_WS_TEST_CONSUMER", it will throw an exception "cx_ai_system_fault" with errortext "SOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/".
15. I use t-code SM59 to test connection and get the following info.
Status HTTP Response 200
Status Text OK
Duration Test Call 328 ms.
who can give me the reasons about item 11 and 14, and explain me how to create service provider and service consumer for a Function Module.
Thanks in advance
Johnneyhave you seen this weblog
/people/thomas.jung3/blog/2004/11/15/bsp-150-a-developer146s-journal-part-xiii-developing-abap-webservices -
How to create web services in java?
Hi,
I am a newbie to java webservices. Can anybody tell me how to create web services in java?
Any tutorial link or step by step doc would be useful.
Appreciate your help in this regard.
Thanks in advance.
naymo01.Creating web services in Java appears to depend highly upon the server you intend to use.
Here's a tutorial: http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html -
How to create Web Service based on PI WSDL message
Hi all,
we have following scenario:
Within PI (version 7.1) we set up a message type and inbound service interface. This service interface should send the PI message to a web service running on a SAP J2EE (version 7.01). As the PI message is sent as WSDL I thought it should be easy to build a web service on the SAP J2EE based on this WSDL from PI.
Unfortunately, I have problems creating the Web Service.
For my current project we integrated the NWDI to the SAP NetWeaver Developer Studio and I'm required to add the Web Service to an existing DC (Development Component) within the NWDI.
What I tried so far is:
- I created a Deployable Proxy Project and within this I created a Client Proxy Definition based on the WSDL from the PI. But I can't add this Proxy to the DCs of the NWDI and I don't know how to implement my own coding here in order execute specific functions.
- I created a new class within the NWDI DC and a public method. Based on this I created a Virtual Interface and a Web Service Definition (WSD). Then I added this to a Web Service Deployment Descriptor. I uploaded this to the SAP J2EE. But I'm not able to access this and I don't know hoe to assign the WSDL here.
I also tried here to create a client proxy based on this WSD as I thought I might assign the WSDL here. But I don't see the WSD in the list of Web Services uploaded to the SAP J2EE...
Can you please advice me how to create a Web Service in such an environment?
regards
René JurmannHi Tahir,
sorry that you needed to wait this long - but this is how I created the web service:
The steps on how to create the web service in NetWeaver Developer studio are nearly the same as described in the blog http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5838. [original link is broken] [original link is broken] [original link is broken]
Some steps I just skipped and some others I added. Some of the steps I did the way I described it as I needed to connect the web service with the SAP PI.
Prerequisites:
Add Java Perspective and J2EE Development Perspective to the open perspectives.
Within "Window - Preferences - Web Services" check "Soap extensions visible in the virtual interface editor"
The SDM of the corresponding SAP J2EE is configured within "Window - Preferences"
Create a Development Component (DC) with type "J2EE -> EJB Module"
The business logic of the web service will be implemented in an Enterprise Java Bean (EJB). So first the EJB component must be created:
Choose "File -> New -> Other"
In opening PopUp choose "Development Component -> Development Component Project"
Select the Software Component for which you want to add the DC (e.g. "Local Development -> MyComponents")
Choose now vendor, name and type:
vendor is an alpha-numeric string of 20 characters starting with a letter - all in lower case
name is an alpha-numeric string starting with a letter - all in lower case
vendor and name concatenated must not be longer then 40 characters
the name can be separated into different part using "/" as separator
each part of the name must not be longer than 8 characters
the type is "J2EE - EJB Module"
you can specify a Caption as general description for the web service
Create new EJB
To create the EJB itself:
In J2EE DC Explorer of J2EE Development Perspective expand new DC and right-click on folder "ejbModule"
Choose "New - EJB" with following details:
EJB Name: <name as for PI service Interface to be created - starting in upper case>
EJB Project: <pre selected>
Bean Type: Stateless Session Bean
Default EJB Package: <corresponds to namespace in PI>
generate default interfaces: Checked
Regarding the "Default EJB Package" this should be created according the namespace in PI for which all PI objects will be created. This only applies if you have some naming conventions here.
Example:
Namespace in PI is: http://company.net/pi/SOFTWARE_COMP/Application
The corresponding package then is: net.company.pi.software_comp.application
Implement coding for web service
As the web service will be called via PI some transfer variables will be submitted. Most likely, those variables will not be standard type (e.g. String) but a complex type. Those types must be generated as Java classes. Below an example of a complex type I needed:
Data Type
net.company.pi.software_comp.application.types.MessageProcessingInformation
Structure:
Element name Element type
sendingSystemID String
interfaceID String
businessProcessVariantCode String
testIndicator Boolean
For every element described a public "get", "set" and "has" method must be created in the corresponding Java class:
package net.company.pi.software_comp.application.types;
import java.io.Serializable;
public class MessageProcessingInformation implements Serializable {
protected String sendingSystemID;
protected String interfaceID;
protected String businessProcessVariantCode;
protected Boolean testIndicator;
public String getSendingSystemID() {
return sendingSystemID;
public void setSendingSystemID(String value) {
this.sendingSystemID = value;
public boolean hasSendingSystemID() {
if(sendingSystemID != null && !sendingSystemID.equals("")){
return true;
return false;
All Java classes representing complex types and all classes referenced here (used for sub-types) must implement java.io.Serializable. Java standard types which do not implement this class must not be used as sub-types.
As soon as all data types are declared the real business logic can be implemented:
In J2EE DC Explorer of J2EE Development Perspective expand DC - "ejb-jar.xml" - <Name> and double click on "ejbCreate"
In detail view select folder "Business Methods" and click "Add"
choose name of business method - this should be the same as the PI message type used for the service interface - starting lower case
return type should be "void"
add needed parameters fully qualified - including package (as specified in PI and created previously in DC)
you can mark certain parameters as array if necessary
Remark:
It might be that after saving you get an error. This might be as the package name of one component is copied to the corresponding Java class at the very beginning (before the package declaration within the Java class). Simply delete the string here.
It also might be, that the new business method is only defined in the remote interface class but not in the bean class. Just create an according method in the bean class.
Within the newly created business method within the bean class you can now implement the business logic.
Create a DC with type "J2EE -> Enterprise Application"
In order to create the "real" web service and deploy it to the J2EE an Enterprise Application project has to be created. So create a new DC as for the EJB Module but choose as type "J2EE -> Enterprise Application".
After the DC is created right click on the EJB DC and choose "Add to EAR Project". Choose the new DC.
Create web service for EJB
As soon as you implemented the business logic you can create the "real" web service. Therefore:
Right click on the EJB name below "ejb-jar.xml"
Choose "New - Web Service"
Choose proper "Web Service Name" and "Configuration Name" (probably oriented at the EJB name)
Copy the URL of the web service - you'll need it later for PI configuration
on the second next screen use the same name for "Virtual Interface" and "Web Service Definition" (the name should be the name of the "Endpoint")
the "EAR Project" should be preselected
Unfortunately, the web service can't be used in its current configuration to be accessed by PI. Therefore the Virtual Interface must be changed. To do so, expand folder "Virtual Interfaces" and double click the virtual interface created.
Within the detail view expand in tabs "Mapping" and "Types" the complete folder structure. For any "SOAP Extension" where a namespace can be defined use as namespace the corresponding namespace in PI (e.g. http://corpintra.net/pi/CBFC_GLOBAL_SAP_APPL/BillerDirect) but do not change any "Soap Extension" of a standard Java type. (if you don't have any naming convetions for namespaces in PI you can leave the SOAP Extension here. But then the namespace in PI should be set accordingly.)
Probably it can be necessary on top level "Soap Extensions" in tab "Mapping" to leave "Use Namespaces for Parameters" unchecked. For some of my web services this parameter must be checked for others not - just try.
If you can define a "New Name", "Local Name" or "Item Label" for a Soap Extension then use a name with starting upper case letter. (For Java Naming conventions most of the data type names will start with lower case letters.) Especially the method name must be renamed this way in order to stick to the PI namings.
As a last point to change here check in tab "Mapping" all "Incoming Parameters" which you specified as array. Use for those as "New Name" a different name - do not just simply change from lower case to upper case. This is necessary as on PI we need to create two levels although here only one is specified.
For any own sub-type declared as array the name within the coding should also differ from the corresponding Java Class name the type refers to.
If all this is done you can deploy the web service to the J2EE:
right click on "Enterprise Application" DC and choose "Development Component - Build..." and build all corresponding components
right click on "Enterprise Application" DC and choose "Development Component - Deploy"
Test the new web service via <J2EE URL>/wsnavigator/enterwsdl.html
Create PI interface
After the web service is created successfully the PI integration can be started.
Therefore, within the Enterprise Services Builder create a data type according to the web service definition. All components defined on top-level for this data type should be declared as incoming parameter for the web service business method. Therefore it could be necessary to create some sub data types on PI first and add those to the "master" data type.
Ensure that the names of the components correspond to the names defined in the web service (see virtual interface here). Those names must exactly be the same - including lower/upper case. Also take care for the ordering of the components.
In case you need to include arrays following applies:
The upper level is of occurrence "1:1". This has only one sub-entry with occurrence "1:n". The names for upper and sub-level must not equal.
Based on the data type a message type is created. The name of the message type must be exactly the same as the name of the web service business method. (Hint: the name of the web service business method was most likely changed in the virtual interface. Then this name must correspond to the message type name.) Based on the message type an asynchronous inbound interface is to be created (which will be referred in the Integration Directory). The operation name for this interface (left panel) should be the same as the name for the web service business method.
Create PI mappings and routings
How to map (message mapping and operation mapping) from source to the web service message I wont explain here as this depends on the source message. The only important things here are:
When creating the SOAP communication channel within the Integration Builder the "Target URL" is:
<J2EE URL>/<Access URL as specified in web service creation>?wsdl&style=document
The soap action is the name of the web service business method.
Most likely the web service needs authentication to be executed. -
Creating Web service for PL/SQL Procedure with Complex Data Types
I need to created web service for PL/SQL Procedure with Complex Data types like table of records as parameters, how do we map the pl/sql table type parameters with web service, how to go about these?
Hello,
When you are creating a service from a Stored Procedure, the OracleAS WS tools will create necessary Java and PL wrapper code to handle the complex types (table of record) properly and make them compatible with XML format for SOAP messages.
So what you should do is to use JDeveloper or WSA command line, to create a service from your store procedure and you will see that most of the work will be done for you.
You can find more information in the:
- Developing Web Services that Expose Database Resources
chapter of the Web Service Developer's guide.
Regards
Tugdual Grall -
Any difference in creating a web service from a java class or session bean?
Hi,
The JDeveloper tutorial at http://www.oracle.com/technology/obe/obe1013jdev/10131/devdepandmanagingws/devdepandmanagingws.htm demonstrates creating a web service from a plain java class. I'm wondering:
- Is it possible to create a web service from a stateless session bean instead of a java class? If so, what's the proper way to do this in JDeveloper? When I tried doing so in JDeveloper 10.1.3.0.4 (SU5) using the J2EE Web Service wizard, the wizard did not list the session bean in the Component To Publish dropdown (it does list any java classes available in the project). I can proceed by manually typing in the name of the session bean. After the wizard completes though, the @Stateless annotation that had been in my session bean class code is removed and replaced by a @WebService annotation. The end result is that it looks like it made no difference whether I had tried to create the web service from a session bean or plain java class as the annotations in the resulting web service code are the same (although if I had started from a session bean, the class for the web service still implements the Local/Remote EJB interface that the session bean originally implemented).
- Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean? I'm creating the web service from scratch so I also need to either build the java class or stateless session bean the web service would be based on from scratch too.
Thanks for any ideas about this.Hi,
EJB Session beans (EJB 3.0) are deployed as WebServices by annotating the class with @WebService and the methds with @WebMethod (both tags require you to add the JSR-181 library to your project (available in the JDeveloper list of libraries)). Unlike the J2E WebService, the EJB session bean service is turned into a WebService upon deployment. This means you obtain teh WSDL file after deployment
- Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean?
The difference is that EJB Session bean based web services are integrated with the J2EE container, which means that they can leverage container services like transaction handling, data sources, security, JMS etc.
Frank -
How to create Web Service Proxy with help of WSDL.
Hi ,
How to create Web Service Proxy with help of WSDL .
Please help me .
Thanks in advacne for reply .check out this article. It has all the details
http://www.oracle.com/technology/products/jdev/howtos/1013/wsadf/adfcomplexwstypes.html -
How to create web service client
Hi All,
I am new to web services .Can any body explain how to create web service client ....
Please give the give the discription step wise.
Thanx
ArunHi Krishna,
Yes it is possible.
Check this Link
[JDeveloper Web Service|http://www.oracle.com/technology/obe/obe1013jdev/10131/10131_wstopdown/wstopdown.htm#t2]
http://www.oracle.com/technology/obe/obe1013jdev/10131/10131_wstopdown/wstopdown.htm#t2
I strongly suggest you to go for Eclipse, instead of Netbeans or Jdeveloper incase of WebService. If you want to run your code in all the Server without making any changes go for Eclipse based development for Web Service.
Kindly let me know if you need some more inputs.
Regards,
Zack -
How to create Web Service as a source system in BI and configure a DS
Hello,
I was wondering if you can give me the links to information where it is explained how to create Web Service as a source system in BI 7 NW 2004s and also how to create a data source that would read data from that Web Service?
Thanks,
AGHi AG.
Please check the following documentation which talk about this questions.
[Creating Web Service Source System|http://help.sap.com/saphelp_nw70/helpdata/EN/80/1a618ae07211d2acb80000e829fbfe/frameset.htm]
[Creating DataSources for WebServices|http://help.sap.com/saphelp_nw70/helpdata/EN/43/ec90a315434c5de10000000a155369/frameset.htm]
[Transfering Data Using WebServices|http://help.sap.com/saphelp_nw70/helpdata/EN/80/1a618ae07211d2acb80000e829fbfe/frameset.htm]
I hope that I can be helpful.
Thanks,
Walter Oliveira. -
XI for create web servicies for SAP R/3 4.6C
Hi All,
we are implementing PM (Plant Management) module of SAP R/3 4.6C and we have the necessity to create web services for some PM functionalities. Infact we need to integrate our SAP R/3 4.6C with other applications (non-SAP) through TIBCO (it's mandatory). So we think to use SAP XI. Moreover our users don't want to use SAP GUI for the accessing to the PM functionalities but they want an UI more friendly. So we think to use SAP EP.
Which is your opinion about this architectural scenario? Is it possible to fulfil the requirement of our business users with a more simple architectural solution (for example with WEB DYNPRO)?
Many thanks in advance for your collaboration.
Regards,
BobInfact we need to integrate our SAP R/3 4.6C with other applications (non-SAP) through TIBCO (it's mandatory). So we think to use SAP XI.
TIBCO is another middleware. So once you expose your R/3 functionalities as web service, you may directly use TIBCO to integrate and XI won't be required at all.
Moreover our users don't want to use SAP GUI for the accessing to the PM functionalities but they want an UI more friendly.
WebDynpro application would provide you an easy GUI and could act as Soap client as well to send data.
Regards,
Prateek -
How to create Web services to communicate InfoPath forms to Share Point lists ?
How to create Web services to communicate InfoPath forms to Share Point lists ?
Hi,
As per your posting and my understanding, you wanted to communicate your infopath with SharePoint list/library. Please refer the below link(s) which may help you to solve your issue.
http://blogs.msdn.com/b/russmax/archive/2012/08/17/want-to-call-sharepoint-2010-web-services-within-browser-based-infopath-2010-forms.aspx
http://jaliyaudagedara.blogspot.in/2011/03/submitting-data-to-sharepoint-2010-list.html
or
http://blogs.msdn.com/b/infopath/archive/2007/03/26/submitting-to-a-sharepoint-list.aspx
If you need more help please let usknow
Sekar - Our life is short, so help others to grow
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever you
see a reply being an answer to the question of the thread, click "Mark As Answer -
How to create Web Service & Web Service Client on OCMS
Hi all,
Is anybody can show me how to create Web Service on OCMS?
I only know how to do it on WebLogic Server.
It has many differences between OCMS and WLS.
Thanks & Regards,
Jack.Jack,
This tutorial can help:
http://www.oracle.com/technology/products/ocms/pdf/parlayxjdeveloper.pdf
Regards,
Adam -
How to call web-service using only java code
Hello, how to call web-service using only java code. I can call it from BPM process or Web Dynpro Java Application, but if I need to call it from ejb component?
I'm found answer:
Java and SAP Portal blog: How to call web service from java code example
Maybe you are looking for
-
Group policy Preferences server 2008 and windows 7
Hi I have been struggling with an issue with group policy preferences for a while now with regard to pushing out printers to windows 7 (32/64 bit) Machines. I have two DC servers one is 2008 and the other is 2008 r2. I have setup the group policies o
-
So unfortunately my old 13" MacBook Pro got a drink spilled across it a few months back. Mr Genius at the Apple store took one look inside and shook his head "Catastrophic failure, It's hit the fan and gone everywhere". But it wasnt all bad news, He
-
OGG Vorbis in iTunes 10?
How to play OGG Vorbis in iTunes 10? Tried XiphQT 0.1.9 and oggvorbis_r45 component, but no luck.. Any ideas ?
-
Unable to connect to CMS - A wrong connection is made
From an ASP.Net application on my local machine, I am attempting to set a report source to a report in InfoView on a different server. I am having problems getting an EnterpriseService object created when calling a SessionMgr.Logon method. The error
-
Error in Computing Database statistics while running Update optimizer stati
Dear All, I am getting following error while executing Update optimizer statistics on my ECC Production Server. BR0280I BRCONNECT time stamp: 2011-09-07 06.00.34 BR0815I Number of indexes in schema of owner SAPFEP: 82458 BR0815I Number of indexes in