on 06-12-2011 5:15 PM
Hi,
I have a web dynpro application that can access an external database via EJB. I also have a web module (JSP). In the web dynpro application there is a button that calls a webpage from my web module.
Supposedly, when I click the button, the values in webpage will be taken from my external database (e.g. the text values of my webpage will come from my database).
I have been told to create a web service using my EJB and have to import that web service to my web module using a java class. Can someone point me to a tutorial on how to do this?
Hi mlsaldua,
Please go through this link.
Thanks and Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John Wu,
I need web service because my project requires it. It would really be easy just to call ejb using models but I can't do that.
And you're right, I will be needing pure java programming. I've already created my stubs using wsimport of my wsdl. But now I can't incorporate it on my NWDS web module.
Hi mlsaldua,
please check this code
public class WsClnt2 {
static final String userid = "test";
static final String password = "init2you";
static String soapRequestMsg = "<ns1:MaterialGetDetail
xmlns:ns1='urn:sap-com:document:sap:soap:functions:mc-style'><Material>R-1111</Material><Plant>1200</Plant><Valuationarea>1200</Valuationarea></ns1:MaterialGetDetail>"
;
static class TheAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(userid,
password.toCharArray()));
}
}
public static void main(String[] args) {
try{
String url =
"
http://host:port/sap/bc/srt/rfc/sap/ZWS_MATERIAL_DETAIL?sap-client=800
";
Authenticator.setDefault(new TheAuthenticator());
MessageFactory msgf = MessageFactory.newInstance();
SOAPMessage msg = msgf.createMessage();
SOAPBody body =
msg.getSOAPPart().getEnvelope().getBody();
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
ByteArrayInputStream bis=new
ByteArrayInputStream(soapRequestMsg.getBytes());
org.w3c.dom.Document doc = db.parse(bis);
body.addDocument(doc);
SOAPConnection connection =
SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage reply = connection.call(msg, url);
reply.writeTo(System.out);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/SAAJ/saaj-api.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/saaj-impl.jar"/>
<classpathentry kind="lib" path="C:/bi_sdk/lib/activation.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/New
Folder/xercesImpl-1.5.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/xerces.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/xmlpublic-2.0.0.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/jaxb-xalan-1.5.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/jaxws-api-2.1-1.jar"/>
<classpathentry kind="lib" path="C:/SAAJ/jaxb-api-1.5.jar"/>
<classpathentry kind="lib" path="C:/jdk1.5.0_12/jre/lib/rt.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
Thanks and Regards,
Mithu
Hi,
Search for EJB webservice in NWDS help.
There is step by step guide there.
Regards,
Himanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.