开发者

SOAP in .jsp file

开发者 https://www.devze.com 2023-03-14 19:32 出处:网络
I had decided to use ReST on this project, but I was told yesterday that currently their API doesnt support POST in ReST and that I should use SOAP.

I had decided to use ReST on this project, but I was told yesterday that currently their API doesnt support POST in ReST and that I should use SOAP.

Basically, we have a "register" user page that submits the data to our own database. The goal is to submit the same data to our email campaign service (which开发者_开发知识库 they supplied a wsdl link).

I have never use SOAP (or ReST for that matter), and I was wondering if it is even possible to do this within a jsp page. The form is pretty simple with two inputs called "cust_name" and "cust_email".

I have tried seraching online, but the results were pretty slim for SOAP implemented in .jsp . Do I need to 'include' soap page into the .jsp page, or is there an easier method.

Thanks.


You can do anything in a JSP page that you can do in a servlet (in fact, JSP pages are converted to servlets before they are compiled!). However, embedding Java code in a JSP is considered to go against best practice. You should create a servlet that can interact with your webservice (perhaps using Apache Axis) and then place the relevant information into a model of some sort, and then display it with the JSP. Doing it this way preserves the model-view-controller paradigm. The JSP is the view and the servlet is the controller. Does that make sense?

Apache Axis will take a WSDL and create stub Java code to interact with the webservice (create any necessary SOAP envelopes, etc) so that you can interact with it like it was local to the application. That's definitely the way to go if you have access to a WSDL so you don't end up rewriting all of the xml generation code inherent to SOAP.


Apache Axis would be installed on your client. It is only going to generate the Java code. You will have to add the java packages that you create, and probably some of the apache axis java as well. Although you don't have root access, I assume that you do have access to the java code, and that's all you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消