Webservice return type
Dear All,
I have a web service with return type as array.
I need to return dynamic array.Is there any alternate way to this.
Could anyone help me regarding this.
Thanks & Regards
sara
On xMII XML format via the WebService (WSDLGen) mechanism, but you can return any xMII XML format via the Runner mechanism.
URL is something like: /Lighthammer/Runner?Transaction=YourTransaction&OutputParameter=DesiredXMLOutputParameter
There are more complex techniques that can be used to have xMII emulate any webservice with any inputs and outputs, but those involve creation of custom WSDL files and are probably a bit lengthy for an SDN post.
- Rick
Message was edited by:
Rick Bullotta
Similar Messages
-
How to create a webservice with return type File
Hi All,
I have a class Letter and I am trying to expose viewReport as webservice.
In Jdeveloper -> Business teir -> webservices -> Java web service and I have selected my method i.e. viewReport
Now it throws error "The return type java.io.File of method viewReport can not be serialized into XML"
I unserstood the issue but How can I achive this in JDeveloper
public class Letter {
public Letter() {
super();
public File viewReport(String name) {
File folder = new File("C:\\APPS\\root\\pdf\\10052011");
File[] listOfFiles = folder.listFiles();
return listOfFiles[0];
}You can't as File is nor serializable. It won't make sense as you would try to give a handle to a file on the server hosting the service to a remote system.
Can you explain the use case in more detail?
Timo -
Stub generated in Jdev9i for webservice with 'Vector' return type
Hi,
In the OAF page that I am developing, I am trying to consume a web service generated in SAP PI using Jdeveloper. My Jdeveloper version is 9.0.3.5(I need to use this version since I need to deploy the OAF page in EBS11i). The stub generated based on the WSDL is given below.
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import org.apache.soap.encoding.soapenc.BeanSerializer;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.util.xml.QName;
import java.util.Vector;
import org.w3c.dom.Element;
import java.net.URL;
import org.apache.soap.Body;
import org.apache.soap.Envelope;
import org.apache.soap.messaging.Message;
* Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
* Date Created: Tue Jan 25 16:12:55 IST 2011
* WSDL URL: file:/C://Working/XXXXXXX/RegConsComplaint_OB.wsdl
public class RegConsComplaint_OBServiceStub
public RegConsComplaint_OBServiceStub()
m_httpConnection = new OracleSOAPHTTPConnection();
public static void main(String[] args)
try
RegConsComplaint_OBServiceStub stub = new RegConsComplaint_OBServiceStub();
// Add your own code here.
catch(Exception ex)
ex.printStackTrace();
public String endpoint = "http://XXXXXX:8000/sap/xi/...../RegConsComplaint_OB";
private OracleSOAPHTTPConnection m_httpConnection = null;
private SOAPMappingRegistry m_smr = null;
public Vector RegConsComplaint_OB(Element requestElem) throws Exception
URL endpointURL = new URL(endpoint);
Envelope requestEnv = new Envelope();
Body requestBody = new Body();
Vector requestBodyEntries = new Vector();
requestBodyEntries.addElement(requestElem);
requestBody.setBodyEntries(requestBodyEntries);
requestEnv.setBody(requestBody);
Message msg = new Message();
msg.setSOAPTransport(m_httpConnection);
msg.send(endpointURL, "http://sap.com/xi/WebService/soap1.1", requestEnv);
Envelope responseEnv = msg.receiveEnvelope();
Body responseBody = responseEnv.getBody();
return responseBody.getBodyEntries();
}I am wondering whether I will be able to use this stub generated by Jdeveloper since the input type is 'Element' and return type is 'Vector'; while in the Jdeveloper documentation the supported "primitive XML Schema types and arrays of primitive XML Schema types as parameters and return values for web services" do not include either of the two.
Regards,
SujoyHi Sujoy
I have been having big problems consuming microsoft sharepoint webservices using jDeveloper 9i.
Problems with jdk version compatability with jDev and NTLM authentication (Sharepoint).
so switching to db connection using utl_http.
Can you pls send me the code set for reference at [email protected]
thanks.
Regards
Sachin -
PI SOAP access to third party Webservice,Return ERROR
Hi Experts,
I have one soap synchronous scenario access to third party WEBSERVICE,Return error.While testing the wsdl in soap ui, I am getting response, messages showing successfully processed. I think it is pi to send xmlns:ns1='http://tempuri.org/' on both sides should not be a single quotation mark, but I don't know how to adjust PI set. how do you see.
1、SOAP UI submitted to Webserver XML
[2014-05-26 08:47:24.662] --- Recv data from SocketId=272 Socket=10880
POST /MWGate/wmgw.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/MongateCsSpSendSmsNew"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 10.0.0.253:8082
Content-Length: 520
<soapen:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapen:Header />
<soapen:Body>
<tem:MongateCsSpSendSmsNew>
<tem:userId>DOA001</tem:userId>
<tem:password>dennis</tem:password>
<tem:pszMobis>1313773654</tem:pszMobis>
<tem:pszMsg>1111</tem:pszMsg>
<tem:iMobiCount>1</tem:iMobiCount>
<tem:pszSubPort>*</tem:pszSubPort>
</tem:MongateCsSpSendSmsNew>
</soapen:Body>
</soapen:Envelope>
2、PI submitted to Webserver XML
[2014-05-26 08:36:08.725] --- Recv data from SocketId=271 Socket=10704
POST /MWGate/wmgw.asmx HTTP/1.0
Accept: */*
Host: 10.0.0.253:8082
User-Agent: SAP-Messaging-com.sap.aii.af.sdk.xi/1.0505
CallingType: SA
content-id: <[email protected]>
Content-Type: text/xml; charset=utf-8
Content-Length: 417
SOAPACTION: "http://tempuri.org/MongateCsSpSendSmsNew"
<SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP:Header />
<SOAP:Body>
<ns1:MongateCsSpSendSmsNew xmlns:ns1='http://tempuri.org/'>
<ns1:userId>DOA001</ns1:userId>
<ns1:password>dennis</ns1:password>
<ns1:pszMobis>13637731567</ns1:pszMobis>
<ns1:pszMsg>Constant</ns1:pszMsg>
<ns1:iMobiCount>1</ns1:iMobiCount>
<ns1:pszSubPort>*</ns1:pszSubPort>
</ns1:MongateCsSpSendSmsNew>
</SOAP:Body>
</SOAP:Envelope>
3、SXI_MONITOR Payloads content:
<ns1:MongateCsSpSendSmsNew xmlns:ns1="http://tempuri.org/">
<ns1:userId>DOA001</ns1:userId>
<ns1:password>dennis</ns1:password>
<ns1:pszMobis>13637731567</ns1:pszMobis>
<ns1:pszMsg>Constant</ns1:pszMsg>
<ns1:iMobiCount>1</ns1:iMobiCount>
<ns1:pszSubPort>*</ns1:pszSubPort>
</ns1:MongateCsSpSendSmsNew>
4、PI channelHi Nathan,
Have you tried the SOAP HTTP Axis function.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b092777b-ee47-2a10-17b3-c5f59380957f?overridelayout=t…
https://help.sap.com/saphelp_nw04/helpdata/en/45/a39e244b030063e10000000a11466f/content.htm
Configuring the Receiver Axis SOAP Adapter (SAP Library - SAP Exchange Infrastructure)
Regards,
Jannus Botha -
How to know return type in Web service
{color:#0000ff}I am writing a web service client application. After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?
{color}
here is the response obtained from web service after invoking a subtract method, it is giving correct value but doesn't give tye of value.
<ns:SubtractResponse xmlns:ns="http://example.ws"><ns:return>81</ns:return></ns:SubtractResponse>View WSDL(Web Service Description Language) file of the web service. Normally WSDL file of any web service can be referenced by appending "wsdl" at the end of web service URL. e.g. http://www.abs.com/mywebservice/invokewebservice?wsdl
Shazzad wrote:
After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?WSDL file for a web service contains all information regarding the web service like types, message, portType, binding, service etc. Types section have schema definitions of all messages which are being used in web service. here you can find everything about all elements, fields for all the messages in the WebService including type of the values.
You can find more about WSDL on Sun and Google very easily.
Hope this will help.
Thanks,
Tejas -
Hi All,
I have one doubt regarding webservice return parameter. I wish to return collection of records from Webservice. I tried to set return type as ResultSet, but i couldn't get?. How can i solve it?.
Thanks advance,
Ravi SankarHi Ravi,
Check
Web service with complex java type
Arraylist in Web Service
Best regards, Maksim Rashchynski. -
Premature EOF encountered with Document as a return type
I have created a web service that returns a Document object. I have successfully deployed the web service to my local OC4J standalone (9.0.3), and tested it within JDeveloper with a stub. The same web service is deployed to our test server running 9iAS 9.0.2, with OC4J 9.0.2. When I change my stub to point to the test server, I get the following error rather than the Document returned:
[SOAPException: faultCode=SOAP-ENV:IOException; msg=Premature EOF encountered; targetException=java.io.EOFException: Premature EOF encountered]
Thinking this was a OC4J version issue, I installed 9.0.3 standalone on the same machine. I am able to navigate to the web services page for my web service successfully, invoke the web service, and see the correct Document embedded within the SOAP response. I was unable to do this on the 9.0.2 OC4J instance. Unfortunately, I get the same error when running the stub from JDeveloper and pointing to the 9.0.3 web service.
In an probably unrelated note, I am trying to use the web services portlet, pointing to my stub to call my web service. With this, I get the following error:
ERROR: Failed to handle HTTP Request
oracle.xml.parser.v2.XMLDOMException: Object not supported in current implementation.
at oracle.xml.parser.v2.XMLDocument.importNode(XMLDocument.java:1303)
at oracle.portal.provider.v2.webservice.RPCWebServiceRenderer.expandResult(Unknown Source)
at oracle.portal.provider.v2.webservice.RPCWebServiceRenderer.invokeService(Unknown Source)
at oracle.portal.provider.v2.webservice.WebServiceRenderer.renderBody(Unknown Source)
at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
Thinking this is an xmlparser version issue, not sure which parser is taking precendence, the OC4J_Portal parser, my application parser, or the ORACLE_HOME parser.
I have thrashed on these issues for a little while, and hopefully I have missed something obvious here. Anything jump out at anyone?
Thanks!Mike,
Thanks for the response. The reason I am inclined to use Document as a return type is for reuse. Our system is based on the creation of Document representations of content to be displayed, and we use framework code to transform given an xsl. I am trying to establish a pattern for publishing web services right from our existing processes that return the Document. I did play with Element, but would rather not go that way.
I think my web service is working fine now, actually. (Why it can't be tested from JDev, I'm not sure. I will try the server side proxy as you suggest). It is returning my xml content within the <return> of the response. The problem is transforming the result with an xsl. I have tried the web services portlet, which won't work for me because of my return type, and I'm now trying the OmniPortlet, which seems to be coming tantalizingly close to working ;). Not sure if you have used the OmniPortlet or not, but running it, I can see the return of the web service with my xml, which looks good, but then I get this error:
3/12/03 8:55 AM omniPortlet: [id=(null), instance=3915_OMNIPORTLET_49587206] XMLData.next => o
racle.webdb.reformlet.ReformletException: Error occured while fetching XML data.
Also, I've had problems getting the OmniPortlet to recognize my xsl filter for the xml being returned.
Anyone have any success using OmniPortlet consuming a web service that returns xml to be transformed with an xsl filter?
Thanks,
Jason -
Exception in Holder for Multiple Return Types
Hi,
I am implementing multiple return types as mentioned at url: -
http://e-docs.bea.com/wls/docs70/webserv/implement.html#1058020
I have a "Ticket" object and its holder "TicketHolder".
I have built the service successfully which has the following method with its
built files: -
public String serviceMethod(String arg,TicketHolder out) {
Ticket tc = new Ticket();
tc.setticketId("001");
out = new TicketHolder();
out.value = tc;
System.out.println("got it man");
return arg;
But when i try to invoke this method from its "http://localhost:8088/WebServices/RegisterTickets"
link (note - RegisterTickets is the service name here), it gives me the following
exception at server side as well as client side: -
javax.xml.rpc.JAXRPCException: Failed to invoke the target:test.MyService@630693
operation name:serviceMethod method:public java.lang.String test.MyService.serviceMethod(java.lang.String,test.TicketHolder)
args:[Ljava.lang.Object;@3d51e3arg.length:2 Due to exception:java.lang.IllegalArgumentException:
argument type mismatch
at weblogic.webservice.component.javaclass.JavaClassInvocationHandler.invoke(JavaClassInvocationHandler.java:97)
at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
at weblogic.webservice.core.HandlerChain.handleRequest(HandlerChain.java:131)
at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:539)
at weblogic.webservice.core.DefaultWebService.invoke(DefaultWebService.java:264)
Can someone help me in resolving this exception?
Any help would be appreciated...
thanks in advance,
Rajesh
apart from it getting ugly with more than twoparameters
What? How is this ugly? ;-)
public String, int, String, Color, String, String
getStateInfo(String abbrev) {
return name, population, stateFlower, stateColor,
or, stateAnimal, governorsName;
there no indication on what the return valuesrepresent.
Well, I guees the API docs would have to speak for
themselves. Or better method naming... In that
sense, it's no different then now. I could write a
method "getStateName()" and return totally different.
public String, int getStateNameAndPopulation(String
abbrev) {...
I used to like "tuples" when I studied The Tom Programming Language (that's how he calls them), as every CS student is a bit of a "featurist"... Now that I came to develop 40 hours a week and to love Java's simple and powerful expressiveness, I tend to find such constructs overly ugly to be avoided as possible... a matter of personal taste, too, I suppose... -
Problems with document return type
Hi, i've deployed a web service in weblogic 6.1 that returns a xml document. When
i try to execute the client, i receive this error message:
------------- RECEIVING XML -------------
<?xml version="1.0"?>
<definitions
targetNamespace="java:examples.webservices.rpcXML.pruebaXML"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="java:examples.webservices.rpcXML.pruebaXML"
xmlns:dom="http://www.w3c.org/1999/DOM"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<types>
<schema targetNamespace='java:examples.webservices.rpcXML.pruebaXML'
xmlns='http://www.w3.org/1999/XMLSchema'>
</schema>
</types>
<message name="getXMLRequest">
</message>
<message name="getXMLResponse">
<part name="return" type="dom:org.w3c.dom.Document" />
</message>
<portType name="PruebaXMLPortType">
<operation name="getXML">
<input message="tns:getXMLRequest"/>
<output message="tns:getXMLResponse"/>
</operation>
</portType>
<binding name="PruebaXMLBinding" type="tns:PruebaXMLPortType"><soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http/"/>
<operation name="getXML">
<soap:operation soapAction="urn:getXML"/>
<input><soap:body use="encoded" namespace='urn:PruebaXML' encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace='urn:PruebaXML' encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="PruebaXML"><documentation>todo</documentation><port name="PruebaXMLPort"
binding="tns:PruebaXMLBinding"><soap:address location="http://localhost:7001/pruebaXML/pruebaXMLuri"/></port></service></definitions>
===================================================================================
ERROR =================================================================
javax.naming.NamingException: i/o failed java.io.IOException: http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/:http://www.w3c.org/1999/DOM:org.w3c.dom.Document:No
codec for decoding http://xml.apache.org/xml-soap/literalxml: [ CodecFactory:
http://schemas.xmlsoap.org/soap/encoding/=null, =null]. Root exception is java.io.IOException:
http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/:http://www.w3c.org/1999/DOM:org.w3c.dom.Document:No
codec for decoding http://xml.apache.org/xml-soap/literalxml: [ CodecFactory:
http://schemas.xmlsoap.org/soap/encoding/=null, =null]
at weblogic.soap.wsdl.binding.Part.typeToClass(Part.java:74)
at weblogic.soap.wsdl.binding.Part.toSoapType(Part.java:51)
at weblogic.soap.wsdl.binding.Message.getReturnType(Message.java:58)
at weblogic.soap.wsdl.binding.BindingOperation.populate(BindingOperation.java:52)
at weblogic.soap.wsdl.binding.Binding.populate(Binding.java:48)
at weblogic.soap.wsdl.binding.Definition.populate(Definition.java:116)
at weblogic.soap.WebServiceProxy.getServiceAt(WebServiceProxy.java:176)
at weblogic.soap.http.SoapContext.lookup(SoapContext.java:76)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at examples.webservices.rpcXML.javaClient.Client.main(Client.java:40)
Exception in thread "main"
This is the wsdl file that weblogic generates:
<?xml version="1.0" ?>
- <definitions targetNamespace="java:examples.webservices.rpcXML.pruebaXML" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="java:examples.webservices.rpcXML.pruebaXML" xmlns:dom="http://www.w3c.org/1999/DOM"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
- <types>
<schema targetNamespace="java:examples.webservices.rpcXML.pruebaXML" xmlns="http://www.w3.org/1999/XMLSchema"
/>
</types>
<message name="getXMLRequest" />
- <message name="getXMLResponse">
<part name="return" type="dom:org.w3c.dom.Document" />
</message>
- <portType name="PruebaXMLPortType">
- <operation name="getXML">
<input message="tns:getXMLRequest" />
<output message="tns:getXMLResponse" />
</operation>
</portType>
- <binding name="PruebaXMLBinding" type="tns:PruebaXMLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/"
/>
- <operation name="getXML">
<soap:operation soapAction="urn:getXML" />
- <input>
<soap:body use="encoded" namespace="urn:PruebaXML" encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/" />
</input>
- <output>
<soap:body use="encoded" namespace="urn:PruebaXML" encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
- <service name="PruebaXML">
<documentation>todo</documentation>
- <port name="PruebaXMLPort" binding="tns:PruebaXMLBinding">
<soap:address location="http://carlos-3-116:7001/pruebaXML/pruebaXMLuri" />
</port>
</service>
</definitions>
Could anyone help me, thanksHere is a the actual php class:
class question{
function getQuestionDetails()
$r = array("r"=>"s","t"=>11230,"wr"=>500);
return $r;
This class has a defined return VO(questionDetails) in flex. It is recognized in the IDE, but when I run the app, I always get a "null object reference" error. I can't seem to convert the result to questionDetails, and I can't access the fields as properties or part of an array of the return object as an instance of "Object".
Any ideas?
Thanks! -
haven't been around in a while, so I thought I'd stir up some comments with a suggestion for a new feature in Java, which I'm sure has been suggested at some point, but I can't remember seeing it talked about, so here goes:
Multiple Return Types:
public String, int getStateInfo(String abbrev) {
if("nj".equalsIgnoreCase(abbrev)) {
return "New Jersey", 11408042;
// ... and other states...
return null, -1;
String name, int population = getStateInfo("nj");
System.out.println("The population of " + name + " is " + population + ".");Yes yes, I know. Create a StateInfo object with the fields needed. Still, I think that could be interesting.apart from it getting ugly with more than twoparameters
What? How is this ugly? ;-)
public String, int, String, Color, String, String
getStateInfo(String abbrev) {
return name, population, stateFlower, stateColor,
or, stateAnimal, governorsName;
there no indication on what the return valuesrepresent.
Well, I guees the API docs would have to speak for
themselves. Or better method naming... In that
sense, it's no different then now. I could write a
method "getStateName()" and return totally different.
public String, int getStateNameAndPopulation(String
abbrev) {...
I used to like "tuples" when I studied The Tom Programming Language (that's how he calls them), as every CS student is a bit of a "featurist"... Now that I came to develop 40 hours a week and to love Java's simple and powerful expressiveness, I tend to find such constructs overly ugly to be avoided as possible... a matter of personal taste, too, I suppose... -
How can I get rid of a type generated by the Data/Services return type wizard?
Hi All,
I have a JSON service that returns an object called "error". The Data/Services "Configure Return Type" wizard automatically turned this into a class "Error".
However, this caused over a hundred errors to show up inside the generated classes, "Call to a possibly undefined method Error." That's because of lines like this:
throw new Error(propertyName + " is not a data property of entity Agreements");
It's trying to throw a regular "Error" object, but now that there's an "Error" class in the same package, that is taking precedence--and that Error object doesn't have a constructor with a single parameter. At least, that's what I think is going on.
I tried to fix it by deleting _ErrorEntityMetadata.as, _Super_Error.as, and Error.as from the valueObjects package. I then opened the FML file and deleted the definition for the entity "Error" and every reference to the Error entity (class) in my FML file.
I then changed my JSON service so that it returns an object called "serviceError" instead of just "error".
But, whenever I re-run the "Configure Return Type" wizard, it regenerates the Error class, even though I've deleted it from everywhere I can find it. That breaks my project completely! How can I end this and get Flash Builder to *stop* generating this type!
In the "Configure Return Type" wizard I very carefully inspected the type of every bit of data coming back to make sure none of them show up as type "Error." And they don't (as expected, since I changed the object's name to serviceError--now the type of that object is ServiceError.
-JoshI think you are facing this known issue https://bugs.adobe.com/jira/browse/FB-29770
Please vote it.
Thanks for the link--I just voted for it.
To avoid this, in the last page of "Configure Return Type", edit return type name to something else (You can also edit subnodes's name too in the wizard).
Actually, that's exactly what I saw doing; I apologize if that wasn't clear in my post.
I closed and restarted Flash Builder, and once I did that Flash Builder stopped generating the Error class. My guess is that the FML file, even though I had updated it (by deleting all references to the Error class), was cached in some fashion by Flash Builder, and restarting Flash Builder forced it to reread the FML file?
Additional point of clarification: my understanding is that the FML file stores all the metadata about the services that Flash Builder has been able to figure out so far, and when you run the Configure Return Type wizard, it will regenerate *every* type in the FML file, even if that type is not mentioned anywhere in the particular return value that you are working with.
Edited to provide additional thoughts on FML file. -
Problem when calling a return type BOOLEAN SQL Function in a package
Hi All,
I am having problem when trying to call a SQL function in a package with return type BOOLEAN
The SQL function signature is as follows
CREATE OR REPLACE PACKAGE RMSOWNER.ORDER_ATTRIB_SQL ****
FUNCTION GET_PO_TYPE_DESC(O_error_message IN OUT VARCHAR2,
I_PO_TYPE IN VARCHAR2,
O_PO_TYPE_DESC IN OUT VARCHAR2)
RETURN BOOLEAN;
Following is my java code
+CallableStatement cs3 = conn.prepareCall("{?=call ORDER_ATTRIB_SQL.GET_PO_TYPE_DESC(?,?,?)}");+
+cs3.registerOutParameter(1, java.sql.Types.BOOLEAN);+
+cs3.registerOutParameter(2, java.sql.Types.VARCHAR);+
+cs3.registerOutParameter(4, java.sql.Types.VARCHAR);+
+cs3.setString(2, "");+
+cs3.setString(3, "ST");+
+cs3.setString(4, "");+
+ResultSet rs3 = cs3.executeQuery();+
I get the following exception, i tried changing the sql type(registerOutParameter) from boolean to bit but i still getting this exception.
But when i call any other functions with return type other than boolean they work perfectly fine.
Please can anyone help me fix this issue, i am not sure if its anything to do with vendor JDBC classes?
+java.sql.SQLException: ORA-06550: line 1, column 13:+
+PLS-00382: expression is of wrong type+
+ORA-06550: line 1, column 7:+
+PL/SQL: Statement ignored+
+ at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)+
+ at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)+
+ at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)+
+ at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)+
+ at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)+
+ at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)+
+ at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)+
+ at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)+
+ at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)+
+ at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)+
#####Hello People!
There is another workaround!!
See the example below:
private String callBooleanAPi(String tableName,String apikey,String dtInicio,String dtFim,String comando) throws SQLException {
CallableStatement cs = null;
String call = "";
String retorno = null;
try {
if(comando.equalsIgnoreCase("INSERT")){
call = "declare x BOOLEAN; y varchar2(2);begin x :=PKG.INSERT(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
} else if(comando.equalsIgnoreCase("UPDATE")){
call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.UPDATE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
} else if(comando.equalsIgnoreCase("DELETE")){
call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.DELETE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
cs = conn.prepareCall(call);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfToSqlDate = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date dataInicialVigencia =null;
java.util.Date dataFinalVigencia = null;
Date dtInicialFormatada =null;
Date dtFinalFormatada = null;
if(dtInicio != null && !dtInicio.equals("")){
dataInicialVigencia = sdf.parse(dtInicio);
dtInicio =sdfToSqlDate.format(dataInicialVigencia);
dtInicialFormatada = Date.valueOf(dtInicio);
if(dtFim != null && !dtFim.equals("")){
dataFinalVigencia = sdf.parse(dtFim);
dtFim =sdfToSqlDate.format(dataFinalVigencia);
dtFinalFormatada = Date.valueOf(dtFim);
cs.setString(1, tableName);
cs.setString(2, apikey);
cs.setDate(3, dtInicialFormatada );
cs.setDate(4, dtFinalFormatada );
cs.registerOutParameter(5, java.sql.Types.VARCHAR);
cs.registerOutParameter(6, java.sql.Types.VARCHAR );
cs.execute();
retorno = cs.getString(6);
System.out.println( cs.getString(5));
} catch(SQLException e){
throw new SQLException("An SQL error ocurred while calling the API COR_VIGENCIA: " + e);
} catch(Exception e){
Debug.logger.error( "Error calculating order: " + id, e );
} finally {
if (cs != null) {
cs.close();
cs = null;
return retorno;
As you can see the CallableStatement class acepts PL/SQl blocks.
Best Regards. -
Should Collections be used as return types across threads?
I am wondering when, if ever, it is appropriate to use a Collection as the return type of a method in a multi-threaded environment. Here is our situation:
We have four classes -- Widget, WidgetManager, ClientA, and ClientB. ClientA and ClientB are running in different Threads from each other and from the WidgetManager.
The WidgetManager class that uses a Collection of Widgets internally, and passes the Collection (or an Iterator over it) out as a return value of a method to ClientA, which is running in another thread. ClientA would start to go through it using next() and hasNext() of the Iterator. If the WidgetManager were to get a request from ClientB running in another thread to eliminate a Widget, it would attempt to remove it from the Collection. If ClientA were still looping through the Iterator, this would throw an IllegalStateException b/c the system would be in an inconsistent state. The Iterator given to the ClientA is directly linked to the actual Collection in the WidgetManager (am I right so far?).
In my opinion, in most cases we don't want to synchronize Collections. In the example above, if we had passed out a synchronized Collection, then the WidgetManager couldn't touch the collection while the client was looping through the Iterator. If the client got hung up while looping, then the WidgetManager would be hung up. In this case, I think that it will be better to use the toArray() method of Collection to just dump out the contents to a plain array of Objects. Actually, the WidgetManager could convert this array of Objects to an array of Widgets before passing it out, which would give us the type checking that we don't get with Containers.
The condition where you would want to use a synchronized Collection would be when you actually want the client to do some writing or removing from the Collection. I would expect this to be pretty rare since you usually dont want to give clients access to an interal member (the Collection) of a class.
I think that it is also possible to have read-only Collections, but I think (don't know for sure) that you would still have the same IllegalStateException or synchronization probelms.
Can someone point out the errors in my thinking? Or should you generally only use Collections as internal members in a multi-threaded environment, and use toArray() whenever you want to pass the Collection's data outside of the class?
Thanks for any help.
KeithI haven't tested what happens when you synchronize the
Collection, but I think that you are right. But this
causes the problem that I mentioned in the first post.
That is, what happens if your client STARTS running
through the Iterator, and then stops or gets hung up
for some reason? I assume that you're still blocked.
And it's pretty important to me in this case to not
t be blocked -- WidgetManager is the highest level
class in the system.
I'd like to know if anyone has tested this.
The Iterator implementations used in java.util do not use any synchronization by itself, (which is what you would expect since synchronization over multiple method call will involve much more complications and slower performance) . With iterator, you have to provide the necessary synchronization yourself to maintain thread-safety like this
Iterator itr = get Iterator from collectionInstance ;
synchronized(collectionInstance) {
while(itr.hasNext())
process itr.next() ...
As long as your client code gracefully exits the synchronized block on a stop( or hangup, given that it is detected and handled fast enough), it will not be a problem.
Also, I'd like an example of when you WOULD want to
return a Collection. I'm specifically interested in
when you would want to return one in a multi-threaded
environment, but I'm beginning to wonder when you
would EVER want to return one from a method.
Collections are great for internal uses, but you lose
type-checking and you expose the internals of your
class to modification when you use them as return
types. And if you're returning a read-only
Collection, you might as well return an array, right?Using a read-only proxy will be much faster and space-efficient than toArray(). -
Two methods with same name but different return type?
Can I have two methods with same name but different return type in Java? I used to do this in C++ (method overloading or function overloading)
Here is my code:
import java.io.*;
public class Test{
public static void main(String ar[]){
try{
//I give an invalid file name to throw IO error.
File file = new File("c:/invalid file name becasue of spaces");
FileWriter writer = new FileWriter(file ,true);
writer.write("Test");
writer.close();
} catch (IOException IOe){
System.out.println("Failure");
//call first method - displays stack trace on screen
showerr(NPe);
//call second method - returns stack trace as string
String msg = showerr(NPe);
System.out.println(msg);
} // end of main
public static void showerr(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
try{
pw.close();
sw.close();
catch (IOException IOe){
IOe.printStackTrace();
String stackTrace = sw.toString();
System.out.println("Null Ptr\n" + stackTrace );
}//end of first showerr
public static String showerr(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
try{
pw.close();
sw.close();
catch (IOException IOe){
IOe.printStackTrace();
return sw.toString();
}//end of second showerr
} // end of class
[\code]Overloading is when you have multiple methods that have the same name and the same return type but take different parameters. See example
public class Overloader {
public String buildError(Exception e){
java.util.Date now = new java.util.Date() ;
java.text.DateFormat format = java.text.DateFormat.getInstance() ;
StringBuffer buffer = new StringBuffer() ;
buffer.append(format.format(now))
.append( " : " )
.append( e.getClass().getName() )
.append( " : " )
.append( e.getMessage() ) ;
return buffer.toString() ;
public String buildError(String msg){
java.util.Date now = new java.util.Date() ;
java.text.DateFormat format = java.text.DateFormat.getInstance() ;
StringBuffer buffer = new StringBuffer() ;
buffer.append(format.format(now))
.append( " : " )
.append( msg ) ;
return buffer.toString() ;
public String buildErrors(int errCount){
java.util.Date now = new java.util.Date() ;
java.text.DateFormat format = java.text.DateFormat.getInstance() ;
StringBuffer buffer = new StringBuffer() ;
buffer.append(format.format(now))
.append( " : " )
.append( "There have been " )
.append( errCount )
.append( " errors encountered.") ;
return buffer.toString() ;
}Make sense ???
Regards, -
The class of the deferred-methods return type "{0}" can not be found.
I am developing a multilingual portal application.
I have the method that changes the locale based on user's choice in the bean and the method is being referred to as below.
<af:selectOneChoice label="Select Language" autoSubmit="true"
value="#{localeBean.locale}"
valueChangeListener="localeBean.changeLocale">
<af:selectItem label="English" value="en" id="si1"/>
<af:selectItem label="French" value="fr" id="si2"/>
<af:selectItem label="Dutch" value="nl" id="si3"/>
</af:selectOneChoice>
when i try to run the application, i am getting compile time errors as below,
The class of the deferred-methods return type "{0}" can not be found.
No property editor found for the bean "javax.el.MethodExpression".
After going through the discussion forums i learned that the compilation errors can be resolved by setting the <jsp:directive.page deferredSyntaxAllowedAsLiteral="false> at the starting of the page.
Even after that i am getting the compilation error.
Any solutions, suggestions or possible approaches would be helpful as i am new to Webcenter Portal development.
Thanks,The error you get points to a problem on the page (somewhere). Switch to source mode and check the right margin if you see orange or red marks. These are pointing to problems (not all are show stoppers, but they give you hints that something is not according to the standard for jsf, jsff, jsp or jspx pages.
Have you checked that the bean is correctly defined and that it's reachable?
Start a fresh page and isolate the problem, e.g. build a selectOneChoiuce on the new page (don't copy it as you might copy the error too) and make it work on the new page. Once you have it running you can compare the solution to your not running page.
Timo
Maybe you are looking for
-
I just got a new iPhone 6 and I want to use iTunes to download songs and back my info up on iCloud, but every time I try to install iTunes it replaces all my shortcuts with iTunes! I had to entirely uninstall it last time to be able to use google chr
-
Hi, I'm recording from a mic into a memory buffer. All works fine, except that it always cuts off the last second even though I believe I'm properly draining the target data line before closing it. I've tested with the AudioRecorder and SimpleAudioRe
-
File Content Conversion (.txt to Xml)
Hi, I am new to XI, can any one help me out for file content conversion on the following senario. what should be the RecordSet RecordStructure Parameters Sender File: .txt sender file ======== 1234,IT,Kannan,test,Ramasamy,33/A,test,Bangalore,Karnatak
-
I just reinstalled Photoshop CS6. I'm running OS X 10.8.2 . I use the Nik plugins suite, and reinstalled them as well. Now whenever I try to use one of those plugins I get the error "Could not complete the ... command because of a problem with the fi
-
Hi everybody. We use the idoc ORDERS05 with message type ORDE to create a order. Next we can receive a modification of this order in another idoc ORDERS05. Anyboydy knows which message type can I use to modify the order??? Regards