Weblogic 10.3 - web service - manual jdbc commit
Hi All,
I need a little help.
I have been made a web service with a web method. My business logic is very strange, and I have to make some jdbc commit manually in the web method. I try to call transaction.begin() and transaction.commit() but the weblogic throws an exception:
javax.transaction.NotSupportedException: Another transaction is associated with this thread. Existing transaction Name=[EJB ...
Could you tell me, how can I get the current transaction context and handle manually the jdbc commit?
_Here is part of my code:_
@WebService()
@Stateless()
public class MyWebService
* Web service operation
@WebMethod(operationName = "businessDataUpload")
public String businessDataUpload(@WebParam(name = "businessData") String businessData)
try
javax.naming.Context ctx = new javax.naming.InitialContext();
javax.transaction.UserTransaction transaction = (UserTransaction) ctx.lookup("javax.transaction.UserTransaction";);
javax.sql.DataSource ds = (DataSource) ctx.lookup(JNDI_NAME);
java.sql.Connection = ds.getConnection();
*transaction.begin();*
// jdbc code here
transaction.commit();
catch (Exception ex)
// transaction rollback
transaction.rollback();
throw new RuntimeException(ex);
Please help me.
thx, SoMa
Edited by: user1130432 on May 27, 2011 9:16 AM
Hi SoMa,
Please try this:
@WebService()
@Stateless()
public class MyWebService
* Web service operation
@WebMethod(operationName = "businessDataUpload")
public String businessDataUpload(@WebParam(name = "businessData") String businessData)
try
javax.naming.Context ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (DataSource) ctx.lookup(JNDI_NAME);
java.sql.Connection con= ds.getConnection();
con.setAutoCommit(false); // By default on JDBC Connections the AutoCommit is TRUE //
// jdbc code here
con.commit();
catch (Exception ex)
// transaction rollback
con.rollback();
throw new RuntimeException(ex);
}Thanks
Ravish Mody
Similar Messages
-
How can I invoke the web service manually in websphere?
Hi
I've developed a webservice application using Rational Application Developer (RAD). I deployed it in a websphere 6.1 application server, using the administration console to import the war file that I had previously exported with RAD.
My webservice application is listed in the "Enterprise Applications" section of websphere's administration console as started.
My question is: how can I invoke the web service manually? Is there some kind of websphere generated webpage that I can use to call it manually?
I tried http://<server:port>/<contextroot> and http://<server:port>/<contextroot>/<servicename> in a webbrowser, but it doesn't work. Is it possible to invoke the web service manually, or do I need to develop a client?
Thanks in advance
PedroHi Bo Wang,
Go to the Portal -> System Administration -> System Configuration
-> Portal Content folder
-> Open Visual Composer folder
There you can see the Webservice Systems you have created through VC.
You can delete the unwanted system here.
Regards,
Shemim -
How to create web service manually in APEX?
When I try to create a web service from wsdl, I get error: "The WSDL document could not be understood by the rendering engine".
I have found no APEX documentation about how to fill data when creating web service manually. I have wsdl file (have put wsdl url into browser and got contents), but don't know what to do with this beast.
Anyone knows what to do?
IgorProxy class is out of date now... proxy class only support stateful web service call... and stateful web service may became a big limitation in development.
Try to thinking about how to use stateless web service call, you may get an alternative solution.
Edited by: user13036981 on 2011-10-7 上午9:20 -
How to build, package & deploy web services manually without ant on JWSDP
Hello,
How can I Build, Package & Deploy web services manually without using ant tool on JWSDP 1.3?.
Because I am having difficulties in using ant tool for my own webservices. ant is very tightly coupled with the directory hierarchy & configuration files (as I go throught the examples of JWSDP1.3). Also I need to learn the overall process going on behind the scene.
I have to teach the simplest required steps to build, package & deploy any webservice to any container independent of application server & OS without using ant tool. It would also help me to understand which items are required as specified in the Web Services Specifications & which one are implementation or platform specific.
Any help would be greatly appreciated.
Thanks,
Iftikhar.Just follow the step of the JWSDP1.3 tutorial..
-
Weblogic 10.3: web service client enable HTTP/HTTPS connection reuse?
hi all,
i am writing an client app to call a web service, through a client proxy generated by jdeveloper/weblogic.
My question is:
for the weblogic web service client proxy, is it possible to enable HTTP/HTTPS connection reuse/pooling?
i see there is many connection created when calling the web service (by command netstat)?
thank you.
lspanybody can help?
thanks -
NullPointerException in WebLogic while accessing web service from client
Hi all,
I have an SPML Web Service developed. The java class from WSDL was generated using wsdlc
<wsdlc srcWsdl="schema/oracle_ws_spmlv2.wsdl" destJwsDir="${classes.dir}" type="JAXWS" explode="true"/>
and then
<jwsc classpath="..." classpathref="wls.jars" srcdir="src/main" destdir="${classes.dir}" keepGenerated="yes">
<jws file="com/oracle/xmlns/idm/identity/webservice/spmlservice/SPMLService_SPMLServiceProviderSoapImpl.java" compiledWsdl="target/oracle_ws_spmlv2_wsdl.jar" type="JAXWS">
<WLHttpTransport contextPath="OIMSPMLWebService" serviceUri="${ear.deployed.name}" portName="SPMLServiceProviderSoap"/>
</jws>
</jwsc>
I have deployed the ear in WLS and generated the client classes.
<clientgen wsdl="http://${weblogic.host}:${weblogic.port}/OIMSPMLWebService/OIMspmlxsd?WSDL" destDir="${classes.dir}" type="JAXWS"/>
I run the client using java command from the terminal. First time, it runs fine. I get a valid response. But often, when I run it a second time, I get the following exception ... I need to undeploy and deploy the ear again. Any help will be appreciated!
Following error appears.
Error 500--Internal Server Error
java.lang.NullPointerException
at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:49)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:521)
at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:452)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:232)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)As a workaround I can start the application in debug mode, log into the Weblogic console and stop then restart the deployment and this issue goes away, sort of a pain but it does work.
-
Urgent: Calling a WebLogic document type Web Service
We have created an one-way, document type web service that works fine with the
clientgen client. When sending the same SOAP message to the service from another
client, it fails with: javax.xml.soap.SOAPException: failed to receive message:
The other client recieves an HTTP 500.
The signature for the service method is:
public void getDiag(Diagnostic diag)
Diagnostic is a complex type generated by autotype from a schema.
The failing client builds the SOAP message and sends it to the WebLogic service
using HttpURLConnection with the request method set to POST and content-type to
text/xml.Is there any error on the server?
Did the method on the end componet invoked?
If you are using WLS 8.1, its better to use SAAJ
instead of plain http url connection. Something like:
SOAPConnectionFactory factory =
SOAPConnectionFactory.newInstance();
SOAPConnection connection =
factory.createConnection();
SOAPMessage response =
connection.call( request, targetURL );
Here is a working example:
http://manojc.com/?sample23
RouterHandler.java
Regards,
-manoj
http://manojc.com
"Steve Watson" <[email protected]> wrote in message
news:3ec13eeb$[email protected]..
>
We have created an one-way, document type web service that works fine withthe
clientgen client. When sending the same SOAP message to the service fromanother
client, it fails with: javax.xml.soap.SOAPException: failed to receivemessage:
>
The other client recieves an HTTP 500.
The signature for the service method is:
public void getDiag(Diagnostic diag)
Diagnostic is a complex type generated by autotype from a schema.
The failing client builds the SOAP message and sends it to the WebLogicservice
using HttpURLConnection with the request method set to POST andcontent-type to
text/xml. -
Hey, Can Anyone help me?.
I Want to make a Web Service in J2EE, but I don't want to use the JWSDK. I want to do all without assistants.
Anyone have some tutorial or manual that con help me.
Sorry for my bad english, I don`t speak english very well.
Thanks a lot.
Marcos L�pez.
Mexico.The JWS tutorial (http://java.sun.com/webservices/downloads/webservicespack.html) does a reasonable job of walking you through a Web service using Ant. We use GNU make, so we looked at the various Ant build.xml files in the tutorial examples for ideas.
-
Usernametoken security in weblogic 7.0 web services
Hi,
Can anybody tell me how to implement username token security in webservices developed on weblogic platform 7.0?
Thanks in advance
ShijoTry to refer to the documentation for
Configuring Security in Web Applications at
http://e-docs.bea.com/wls/docs70///webapp/security.html
Does the weblogic.log file contain any error or warning
messages corresponding to your problem ?
If you have a test case to reproduce the problem, you
can contact BEA support at [email protected]
Thanks
Developer Relations Engineer
-
Unable to get requestor IP in weblogic 9.0 web service custom handler
We used to get HttpServletRequest Object from which we get requestor IP previously, This is code for that
if (context.containsProperty("HTTPRequest")) {
req = (HttpServletRequest) context.getProperty("HTTPRequest");
}else if( context.containsProperty("__BEA_PRIVATE_BINDING_PROP") ){
Object bindingObj = context.getProperty("__BEA_PRIVATE_BINDING_PROP");
if( bindingObj instanceof HttpServerBinding ){
HttpServerBinding binding = (HttpServerBinding) bindingObj;
req = binding.getRequest();
But now this has changed and we are unable to get "__BEA_PRIVATE_BINDING_PROP" either from mime headers OR from MessageContext
This is what we have used
MimeHeaders mimeheaders = soapMessage.getMimeHeaders();
MimeHeader mimeheader = null;
Iterator iter = mimeheaders.getAllHeaders();
while(iter.hasNext()) {
mimeheader = (MimeHeader) iter.next();
// loop through all the context properties
Iterator props = context.getPropertyNames();
while (props.hasNext()){
String propName = (String) props.next();
Requiremnt is to identify the requestor IP. Any help in this would be greatly appreciated.
Thanks in Advance
Raghu.hi:
I followed the instructions of the <b>weblogic test client</b>(http://dev2dev.bea.com/wlserver/wstestclient.html). put the wlstestclient.ear in /bea90/weblogic90/server/lib.
but http://host:port/wls_utc web page does not work.
the messages it shows is "The WebLogic Test Client is not currently installed on this server. For download and installation instructions please see Dev2Dev."
my OS is Redhat Enterprise 3.
please, appreciate to suggestion and documents, thanks.
Rick -
How to compress SOAP response generated by weblogic 7.x web service??
can anybody tell me how to compresse SOAP response generated by weblogic webservice before sending it to client. i have my handler chain to process that response but how to compress that response .My webservice generates response that contains lots of XML data ~25 mb size . it's taking time to reach it to client for that i wanted to compress it . How to do that?can anybody help me?
Thanks........
RahulAnswered on my own:
Just have to use
x_result = http_client->response->get_data( ).
instead of
x_result = http_client->response->to_xstring( ).
Just don't knwo why the filesize is wrong also - but I can work with this image! -
Deployment of JSR-109 Web Services on Weblogic 11g (OAS migration)
Hi.
I'm being part of an ongoing migration effort from Oracle Application Server 10.1.3.5 to WebLogic 11g (10.3.6). Some of the OAS applications use old JSR-109 Web Services, where each service has the following components:
- A SEI interface that extends java.rmi.Remote and declares the service methods, which throw java.rmi.RemoteException (e.g. ServiceSEI)
- A service implementation POJO that implements the SEI interface (e.g. ServiceImpl)
- A [Service]-config.xml file that declares the service and relates name, namespaces, packages, interface and implementation (e.g. Service-config.xml)
- A declaration of the service implementation POJO as a servlet (with mapping) in web.xml (docs says it doesn't have to be technically a servlet)
- A webservices.xml file that defines the service and references the mapping file.
- A [Service]-mapping.xml file that defines the WS-Java mappings.
All the artifacts look right according the old documentation:
- Programming Web Services for WebLogic Server, Creating a J2EE Web Service Manually: http://otndnld.oracle.co.jp/document/products/wls/docs92/webserv/jsr109.html
- Web Services for J2EE 1.0 Final Release Spec: http://download.oracle.com/otndocs/jcp/websvcs-1.0-fr-spec-oth-JSpec/
The Web Services work OK in OAS. When I try to deploy any of the application that contain one of that services to WebLogic, I get the following Exception:
<BEA-101216> <Servlet: "WSServlet_Procesos" failed to preload on startup in Web application: "/webapp".
java.lang.IllegalStateException: ClassNotFound co.com.acme.services.ServiceSEI_serviceOperation_RequestStruct
at weblogic.wsee.bind.runtime.internal.Deploytime109MappingHelper.processTypeMappings(Deploytime109MappingHelper.java:601)
at weblogic.wsee.bind.runtime.internal.Deploytime109MappingHelper.initBindingFileFrom109dd(Deploytime109MappingHelper.java:273)
at weblogic.wsee.bind.runtime.internal.Deploytime109MappingHelper.<init>(Deploytime109MappingHelper.java:171)
at weblogic.wsee.bind.runtime.internal.RuntimeBindingsBuilderImpl.createRuntimeBindings(RuntimeBindingsBuilderImpl.java:86)
at weblogic.wsee.ws.WsBuilder.createRuntimeBindingProvider(WsBuilder.java:705)
at weblogic.wsee.ws.WsBuilder.buildService(WsBuilder.java:201)
at weblogic.wsee.ws.WsFactory.createServerService(WsFactory.java:54)
at weblogic.wsee.deploy.ServletDeployInfo.createWsService(ServletDeployInfo.java:91)
at weblogic.wsee.deploy.DeployInfo.createWsPort(DeployInfo.java:372)
at weblogic.wsee.server.servlet.BaseWSServlet.init(BaseWSServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1981)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1955)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1874)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
I obviously though the EAR package given to me was incomplete, lacking the ClassNotFound related class, but the package was OK, and is exactly the same that deploys without problems in OAS.
The ClassNotFound related class is referenced in the <java-xml-type-mapping> element of the [Service]-mapping.xml file, e.g.:
<java-xml-type-mapping>
<java-type>co.com.acme.services.ServiceSEI_serviceOperation_ResponseStruct</java-type>
<root-type-qname xmlns:typeNS="urn:Service/types">typeNS:serviceOperationResponse</root-type-qname>
<qname-scope>complexType</qname-scope>
<variable-mapping>
<java-variable-name>result</java-variable-name>
<xml-element-name>result</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
I searched the OAs installation deployment dirs looking for the missing class and found it was present in a Jar called deployment-cache.jar. According OC4J related documentation, this Jar es auto-generated at deployment time.
Weblogic 11g documentation says that kind of Web Services will continue to run, without any changes, on version 10.3.x of WebLogic Server because the associated Web services run time is still supported in this release, although it is deprecated and will be removed from the product in future releases (http://docs.oracle.com/cd/E21764_01/web.1111/e13760/upgrade.htm). I know the right estrategy is migrate the Web Services, but right now my client needs to deploy and use them as they are. I think WL recognizes my service since internally is calling a "Deploytime109MappingHelper" class.
¿Is there any way I can deploy that kind of services to Weblogic 11g? ¿I'm I missing some required step?
As a workaround, I included the OAS generated deployment-cache.jar into the EAR to deploy in Weblogic 11g and the app deploys without errors, but I see this is not a nice solution.
Any help would be much appreciated.
Thanks,
Esteban
Edited by: salzo on Oct 30, 2012 9:54 AM
Edited by: salzo on Oct 30, 2012 9:56 AMHi. The [Service]-mapping.xml file is a standard "JAX-RPC mapping file" according the JSR-109 spec and WebLogic 9.2 doc ([1],[2]). That's the file that references the class. Here's a fragment:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
<package-mapping>
<package-type>co.com.acme.services</package-type>
<namespaceURI>urn:Service/types</namespaceURI>
</package-mapping>
<package-mapping>
<package-type>co.com.acme.services</package-type>
<namespaceURI>urn:Services/wsdl</namespaceURI>
</package-mapping>
<java-xml-type-mapping>
<java-type>co.com.acme.services.ServiceSEI_serviceOperation_RequestStruct</java-type>
<root-type-qname xmlns:typeNS="urn:Service/types">typeNS:serviceOperation</root-type-qname>
<qname-scope>complexType</qname-scope>
<variable-mapping>
<java-variable-name>String_1</java-variable-name>
<xml-element-name>String_1</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
I'll take a look at the ant task.
Thank you very much.
[1]http://download.oracle.com/otndocs/jcp/websvcs-1.0-fr-spec-oth-JSpec/
[2]http://otndnld.oracle.co.jp/document/products/wls/docs92/webserv/jsr109.html -
Hi,
Is it possible to deploy an EAR/JAR created using JwsCompile to any J2EE container?
Ideally, I would like to make use of the features that are only provided by WebLogic
Workshop, like State Management, Callbacks too. If possible, what are the steps
involved?
There is an example for interoperability included in the samples that demonstrates
the use of a WebLogic Workshop web service from an ASP.NET web service, participating
in a conversation and accepting a callback. Is it possible to do the same using
a normal C# windows or webforms app instead of using an ASP.NET web service? So,
I would like to access the WebLogic workshop generated web service with state
management and callbacks from a C# windows app.
Thanks in anticipation,
August[att1.html]
-
Custom serializer/deserializer in Weblogic 9 web service
We are able to select XML from the database which is properly formatted to the schema definition of the method return type. Therefore, the serialization/deserialization of XML to JAVA and then back to XML does not make sense.
Is there a way to use a custom serializer/deserializer in a Weblogic 9.1 web service like we could do in Weblogic 8.1? I have read where the 8.1 web services are still supported but we would like to migrate everything over now. In 8.1 the serializer/deserializer was defined in the deployment descriptor. However, I have seen nothing of this kind in Weblogic 9 documentation and all of those classes are now marked Deprecated.
Any help is greatly appreciated. Thanks!Why dont you try removing the ejb-jar.xml and using annotations. You can use @JndiName and @FileGeneration annotations, this should work ...
-Jesus -
Data types supported in weblogic web service
I have used byte[] (base64) array to pass binary data using weblogic in a web service, since byte[] is a java datatype that is supported, is there a definite guideline available that byte [][] ( multi-dimensional array} is not supported in weblogic 8.1? (I have tried and failed with byte [][])
ThanksHi gchirrav ,
Multi-Dimentional array support not listed in supported Data Types in weblogic 8.1.
Go through the following link, you will find supported data types.
http://e-docs.bea.com/wls/docs81/webserv/implement.html#1054236
----Anilkumar kari
Maybe you are looking for
-
So, I recorded video and audio on my Canon 5D Mark II at 1080p, 23.976 fps, and 48khz, 16-bit Stereo audio. And I used a Zoom H4 to record an mp3 audio file at 44.1khz Compressed. When trying to sync the audio in Premiere Pro CC, the audio slowly los
-
Chosing "open all in tabs" only opens the first of the bookemarks in the folder.
I have upgraded my computer with a new processor, RAM, MoBo and GPU. I also updated to the latest version of Firefox. All my bookmarks were transferred over. However there are two main problems. When I select a folder of bookmarks to open and select
-
Unlocking instruments on Garageband.
First time using garageband. Is it normal to have the piano and some minor instruments working and no others available. Says I need to download others using software update. I have tried this but it didn't work. Is it rather that I need to buy someth
-
How do you create 2 Apple libraries
How do you create 2 apple libraries?
-
Every time I open up these files they want to "save" again
Friends, For some reason, every time I open up a certain set of files that a friend sent me, it wants me to save them. IN OTHER WORDS, simply opening the files tricks INDD CS5.5 into thinking I have modified them, but I have not modified them in any