Return arrary of objects from web service
Hello ALL,
This problem has stumped me for several days.
I have a web service and a jsp client. the jsp client call the web service. the web service function return an array of object of DataBaseRecord type. I use XFire + MyEclipse + Tomcat to develop this project in a Linux box.
the web service WelcomeYou is defined as follows
{noformat}public List<DataBaseRecord> WelcomeYou(String ExampleDoc)
List<DataBaseRecord> RetrievalResult = new ArrayList<DataBaseRecord>();
// Search relevant documents according to 'ExampleDoc' from a database
// The search result will be put into a RecordSet object 'rs'
while(rs.next())
DataBaseRecord NewRecord = new DataBaseRecord ();
NewRecord.RetrievedDocID = rs.getString("RetrievalDocID");
NewRecord.SimiScore = Float.valueof(rs.getString("SimiScore"));
RetrievalResult.add(NewRecord );
// I use the following for loop to see the content of RetrievalResult. I can see that the content is just what I expect. Additionally, the size of RetrievalResult is correct too.
for(DataBaseRecord databaserecord : RetrievalResult)
System.out.println(databaserecord.RetrievedDocID + databaserecord.SimiScore);
return RetrievalResult;{noformat}in a jsp file, the web service WelcomeYou is called
{noformat}List<DataBaseRecord> Result = new List<DataBaseRecord>();
Result = srvc.WelcomeYou("some text ");
// I use the following for loop to see the contentof Result, but each element of Result is empty. Moreover, the strange thing is that the size of Result is right.
for(DataBaseRecord databaserecord : Result)
System.out.println(databaserecord.RetrievedDocID + databaserecord.SimiScore);
{noformat}the class DataBaseRecord is defined as follows
{noformat}public class DataBaseRecord{
public String RetrievedDocID;
public float SimiScore;
{noformat}At the very end of the service function body(just before ' return RetrievalResult;'), i check the content of RetrievalResult using a for loop, it is correct.
At the jsp file, immediately after the statement
{noformat} Result = srvc.WelcomeYou("some text ");
{noformat}
{code}
, i check the content of Result using a for loop, it is incorrect except for the size of Result .
I wonder where I am wrong in the above code.
Can you show the UserProfile.java ? That may have some variables, which are not supported in web services.
Similar Messages
-
Return List of object from web service
Hi to all.
I have a java class which returns an array of ojects (custom objects).
With jdeveloper tool i would like to create a ws around my class, but i receive this message:
Method getUsers: The following JavaBean parameters have property descriptors using types that do not have an XML Schema mapping and/or serializer specified:
Code is the following:
public class GETUSERS
//Costruttore di default
public GETUSERS(){}
public UserProfile[] getUsers(String LastName,String Name)
CallableStatement proc = null;
ResultSet rs = null;
UserProfile users[] = null;
int cont=0;
try
Connessione connessione = new Connessione();
Connection conn = connessione.getJNDIConnection();
if (conn != null )
proc = conn.prepareCall("{call procedure(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }");
//Cursore di output
proc.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
proc.setInt(2,1);
proc.setInt(3,100);
proc.setString(4,null);
proc.setString(5,LastName);
proc.setString(6,Name);
proc.setString(7,null);
proc.setString(8,null);
proc.setString(9,null);
proc.setString(10,"n");
proc.setString(11,null);
proc.setString(12,null);
proc.executeQuery();
rs = (ResultSet)proc.getObject(1);
rs.last();
users= new UserProfile[rs.getRow()];
rs.beforeFirst();
while (rs.next())
users[cont].setUID(rs.getString(1));
users[cont].setName(rs.getString(2));
cont++;
rs.close();
proc.close();
catch(Exception ex)
System.out.println(ex.getMessage());
return users;
}Any idea?
ThanksCan you show the UserProfile.java ? That may have some variables, which are not supported in web services.
-
Have the capability that let Entity Objects from Web Services Datasources?
Have the capability that let Entity Objects from Web Services Datasources? or
where can we found the example about implement Entity Objects from Web Services Datasources ?I'm not sure what are you asking for. If you are looking to create a data-control based on a web service then this online demo might help:
http://www.oracle.com/technology/products/jdev/viewlets/1013/WebServicesAndADF_viewlet_swf.html
Or are you asking how to expose an ADF Business Component as a Web service? -
Serialization error while returning Value Object from Web Service
Hi
I have developed a sample Web Service (RPC based), it returns Customer Value Object
when client calls getCustomer method.
I have written a Client (attached the client source code) to invoke the web service
when the client invokes the Web Service it throws an Exception , the Exception
Exception in thread "main" serialization error: no serializer is registered for
(null, {java:customer}Customer)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:62)
at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPResponseSerializer.java:72)
at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(ReferenceableSerializerImpl.java:47)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCall.java:382)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:364)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)
at ClientwithWSDL.main(ClientwithWSDL.java:63)
CAUSE:
no serializer is registered for (null, {java:customer}Customer)
at com.sun.xml.rpc.encoding.TypeMappingUtil.getSerializer(TypeMappingUtil.java:41)
at com.sun.xml.rpc.encoding.InternalTypeMappingRegistryImpl.getSerializer(InternalTypeMappingRegistryImpl.java:287)
at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:47)
at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPResponseSerializer.java:72)
at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(ReferenceableSerializerImpl.java:47)
at com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCall.java:382)
at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:364)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)
at ClientwithWSDL.main(ClientwithWSDL.java:63)
If someone can help me to fix the issue, it will be great.
Thanks
Jeyakumar Raman.I guess, this is because the RI client is not finding the
codec to ser/deser your Value Object. You need to register
the codec in the type mapping registry before you invoke
the web service method.
Here is a sample:
Service service = factory.createService( serviceName );
TypeMappingRegistry registry = service.getTypeMappingRegistry();
TypeMapping mapping = registry.getTypeMapping(
SOAPConstants.URI_NS_SOAP_ENCODING );
mapping.register( SOAPStruct.class,
new QName( "http://soapinterop.org/xsd", "SOAPStruct" ),
new SOAPStructCodec(),
new SOAPStructCodec() );
BTW, you can do the same exact thing on the client by using
WLS impl of JAX-RPC. Is there a reason for using RI on the
client side?
regards,
-manoj
"Jeyakumar Raman" <[email protected]> wrote in message news:[email protected]...
Hi Manoj,
Thanks for your information, Yes, my client is Sun's JAX-RPC based, but the Server
Implementation is done using Weblogic 7.0. When I invoke the Client without WSDL.
It works fine without any problem. But when I invoke the webservice using WSDL,
I am getting this problem.
Here is my Client Code :
* This class demonstrates a java client invoking a WebService.
import java.net.URL;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Service;
import javax.xml.rpc.Call;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
import customer.Customer;
public class ClientwithWSDL {
private static String qnameService = "CustomerService";
private static String qnamePort = "CustomerServicePort";
private static String BODY_NAMESPACE_VALUE =
"http://jeyakumar_3957:7001/Customer";
private static String ENCODING_STYLE_PROPERTY =
"javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD =
"http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
private static String method="getCustomer";
private static String endpoint="http://jeyakumar_3957:7001/webservice/CustomerService?WSDL";
public static void main(String[] args) throws Exception {
// create service factory
ServiceFactory factory = ServiceFactory.newInstance();
// define qnames
QName serviceName =new QName(BODY_NAMESPACE_VALUE, qnameService);
QName portName = new QName(BODY_NAMESPACE_VALUE, qnamePort);
QName operationName = new QName("",method);
URL wsdlLocation = new URL(endpoint);
// create service
Service service = factory.createService(wsdlLocation, serviceName);
// create call
Call call = service.createCall(portName, operationName);
// invoke the remote web service
Customer result = (Customer) call.invoke(new Object[0]);
System.out.println("\n");
System.out.println(result);
"manoj cheenath" <[email protected]> wrote:
>
>
>Hi Jayakumar,
>
>From the stack trace it looks like you are using sun's
>RI of JAX-RPC. I am not sure what is going wrong with RI.
>
>WLS 7.0 got its own implementation of JAX-RPC. Check
>out the link below for details:
>
>http://edocs.bea.com/wls/docs70/webserv/index.html
>
>
>Let us know if you need more details.
>
>--=20
>
>regards,
>-manoj
>
>
>
> "Jeyakumar" <[email protected]> wrote in message =
>news:[email protected]...
>
> Hi
>
> I have developed a sample Web Service (RPC based), it returns Customer
>=
>Value Object
> when client calls getCustomer method.
>
> I have written a Client (attached the client source code) to invoke
>=
>the web service
> when the client invokes the Web Service it throws an Exception , the
>=
>Exception
>
>
> Exception in thread "main" serialization error: no serializer is =
>registered for
> (null, {java:customer}Customer)
> at =
>com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer=
>(DynamicInternalTypeMappingRegistry.java:62)
>
> at =
>com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPRespo=
>nseSerializer.java:72)
> at =
>com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(Reference=
>ableSerializerImpl.java:47)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCal=
>l.java:382)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.ja=
>va:364)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)
> at ClientwithWSDL.main(ClientwithWSDL.java:63)
>
> CAUSE:
>
> no serializer is registered for (null, {java:customer}Customer)
> at =
>com.sun.xml.rpc.encoding.TypeMappingUtil.getSerializer(TypeMappingUtil.ja=
>va:41)
> at =
>com.sun.xml.rpc.encoding.InternalTypeMappingRegistryImpl.getSerializer(In=
>ternalTypeMappingRegistryImpl.java:287)
> at =
>com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer=
>(DynamicInternalTypeMappingRegistry.java:47)
>
> at =
>com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPRespo=
>nseSerializer.java:72)
> at =
>com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(Reference=
>ableSerializerImpl.java:47)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCal=
>l.java:382)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.ja=
>va:364)
> at =
>com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)
> at ClientwithWSDL.main(ClientwithWSDL.java:63)
>
> If someone can help me to fix the issue, it will be great.
>
> Thanks
> Jeyakumar Raman.
>
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML><HEAD>
><META http-equiv=3DContent-Type content=3D"text/html; =
>charset=3Diso-8859-1">
><META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
><STYLE></STYLE>
></HEAD>
><BODY bgColor=3D#ffffff>
><DIV><FONT face=3DCourier size=3D2>Hi Jayakumar,</FONT></DIV>
><DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
><DIV><FONT face=3DCourier size=3D2>From the stack trace it looks like
>=
>you are using=20
>sun's</FONT></DIV>
><DIV><FONT face=3DCourier size=3D2>RI of JAX-RPC. I am not sure
>=
>what is going=20
>wrong with RI.</FONT></DIV>
><DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
><DIV><FONT face=3DCourier size=3D2>WLS 7.0 got its own implementation
>of =
>
></FONT><FONT face=3DCourier size=3D2>JAX-RPC. Check</FONT></DIV>
><DIV><FONT face=3DCourier size=3D2>out the link below for =
>details:</FONT></DIV>
><DIV><FONT face=3DCourier size=3D2></FONT><FONT face=3DCourier=20
>size=3D2></FONT> </DIV>
><DIV><FONT face=3DCourier size=3D2><A=20
>href=3D"http://edocs.bea.com/wls/docs70/webserv/index.html">http://edocs.=
>bea.com/wls/docs70/webserv/index.html</A></FONT></DIV>
><DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
><DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
><DIV><FONT face=3DCourier size=3D2>Let us know if you need more=20
>details.</FONT></DIV>
><DIV><BR>-- <BR><BR>regards,<BR>-manoj</DIV>
><DIV> </DIV>
><DIV><BR> </DIV>
><BLOCKQUOTE=20
>style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
>BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
> <DIV>"Jeyakumar" <<A=20
> href=3D"mailto:[email protected]">[email protected]</A>>
>=
>wrote in=20
> message <A=20
> =
>href=3D"news:[email protected]">news:[email protected]=
>a.com</A>...</DIV><BR>Hi<BR><BR>I=20
> have developed a sample Web Service (RPC based), it returns Customer
>=
>Value=20
> Object<BR>when client calls getCustomer method.<BR><BR>I have written
>=
>a Client=20
> (attached the client source code) to invoke the web service<BR>when
>=
>the client=20
> invokes the Web Service it throws an Exception , the=20
> Exception<BR><BR><BR>Exception in thread "main" serialization error:
>=
>no=20
> serializer is registered for<BR>(null,=20
> {java:customer}Customer)<BR>
>=
>at=20
> =
>com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer=
>(DynamicInternalTypeMappingRegistry.java:62)<BR><BR> &nb=
>sp; =20
> at=20
> =
>com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPRespo=
>nseSerializer.java:72)<BR> =20
> at=20
> =
>com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(Reference=
>ableSerializerImpl.java:47)<BR> =
>=20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCal=
>l.java:382)<BR> =20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.ja=
>va:364)<BR> =20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)<BR> =
> =20
> at ClientwithWSDL.main(ClientwithWSDL.java:63)<BR><BR>CAUSE:<BR><BR>no
>=
>
> serializer is registered for (null,=20
> {java:customer}Customer)<BR>
>=
>at=20
> =
>com.sun.xml.rpc.encoding.TypeMappingUtil.getSerializer(TypeMappingUtil.ja=
>va:41)<BR> =20
> at=20
> =
>com.sun.xml.rpc.encoding.InternalTypeMappingRegistryImpl.getSerializer(In=
>ternalTypeMappingRegistryImpl.java:287)<BR> =
> =20
> at=20
> =
>com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer=
>(DynamicInternalTypeMappingRegistry.java:47)<BR><BR> &nb=
>sp; =20
> at=20
> =
>com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPRespo=
>nseSerializer.java:72)<BR> =20
> at=20
> =
>com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(Reference=
>ableSerializerImpl.java:47)<BR> =
>=20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCal=
>l.java:382)<BR> =20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.ja=
>va:364)<BR> =20
> at=20
> =
>com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:259)<BR> =
> =20
> at ClientwithWSDL.main(ClientwithWSDL.java:63)<BR><BR>If someone can
>=
>help me=20
> to fix the issue, it will be great.<BR><BR>Thanks<BR>Jeyakumar=20
>Raman.</BLOCKQUOTE></BODY></HTML>
>
>
[att1.html] -
Re: Returning Objects from Web Services
Hello,
I'm doing a project which uses Java web services. I'm using the Web Services templates under Netbeans 6 IDE to accomplish this.
I have followed some basic tutorials and have set up a service that returns integer datatypes etc. I need to know how I can return an object from a webservice and have a client retrieve the attributes of this object.
I have attempted this, and it returns server.Comp@8d8fce, the name of my class is "Comp", the package is "server" and I guess the hex value is the address of the object pointer.
I've been looking around all day and I can't seem to figure this out. Could someone explain to me how this is done. Or maybe even point me in the right direction?
Thanks,
nerdjockFrom what you have written I assume you don't understand how to read/set object properties thats why it doesn't work for you. You can follow many tutorials found on the web like this one: http://www.netbeans.org/kb/50/quickstart-webservice-client.html#consumingthewebservice-j2se.
When using Netbeans 6.0 or 5.5 basicaly you don't have to do much to create ws and ws consumer, just follow the wizards.
1. Create the web service (either as a web applicaton or EJB)
2. Create Java SE application, set "create main method" option
3. Right click on the SE project and choose Create Web Service client,
4. Pick up the WSDL of earlier developed web service
5. Click Finish to generate the stubs.
6. Expand created folder with generated stubs up to the method names
7. Drag the method in the SE project main method scope
For sure you can find more detailed tutorials on the web. Good luck!
Kris -
Extracting Array of objects from web service
After a couple days of head banging I now have a webservice
call executing and I am trying to extract / create a class from the
ResultEvent:
If the xml returned from the web service is:
<people>
<person name="Mike" />
<person name="Dave" />
</people>
and the class is:
class Person
public var Name:String;
The result event is:
private function doResults(result:ResultEvent):void
// how do I create an array of Person objects from result, I
would also like to know how to create a typed array something like
class PersonList if possible. I just need the raw how to loop the
result and set the values on the class
Thanks,
MikeWell I wound up with just trial and error until I got it
working, Im sure this will be improved as I go, but it's enough to
press on with the app for now, this code is in the result function
and result is the ResultEvent wich appears to be an array of
generic objects representing the objects returned by the service.
This in no way uses FDS and is talking to a simple dotnet / asp.net
web service.
// here app is a singleton class for app level data it is
bindable and is used to update the view which in this example is
bound to a public var MyObjects which in this case is an
ArrayCollection, I unbox to MyObject in a custom view control
for (var s:String in result.result)
m = new MyObject();
m.ID = result.result[s].ID;
m.Name = result.result[s].Name;
m.Type = result.result[s].Type;
app.MyObjects.addItem(m);
It also appears that you should create the WebService one
time, and store refrences to the methods during app startup, the
methods are called Operations and it appears you set the result and
fault events then call send on the operation to get the data.
// store this in a singleton app class
var ws:WebService = new WebService();
ws.wsdl = "
http://dev.domain.com/WebService.asmx?WSDL";
ws.addEventListener("result",doResults);
ws.addEventListener("fault",doFault);
ws.loadWSDL();
// this is the operation which is also stored in the
singleton app class
var op:AbstractOperation = ws.getOperation("GetModules");
// elsewere in the app we get the operation refrence setup
result and fault and call send, then copy the generic object into
our cutom classes using the first chunk of code above
op.addEventListener("result",doResults);
op.addEventListener("fault",doFault);
op.send();
I thought I would post this as I could find no such example
in the offline or online docs, If anyone has a better way or see's
a problem please post.
I hope helps others with non FDS service calls and I look
forward to hearing comments.
Thanks,
Mike -
Returning XML to client from web service
Hi,
I am new to developing web services using JAX_RPC. I am trying to return a xml document to the client from the web service.
My Server implementation is as follows:
Interface:
public interface OntoIF extends Remote
public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException;
Implementaion:
public class OntoImpl implements OntoIF
public DataHandler ontoCompare (String targetUrl,String sourceUrl ) throws RemoteException
DataHandler dataHandler = new DataHandler( new StreamSource( new File ("status.xml")), "text/xml");
return dataHandler;
Client Implementation:
Stub stb = (Stub) (new OntoService_Impl().getOntoIFPort());
stb._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:8080/onto-service/onto");
OntoIF onto = (OntoIF) stb;
DataHandler retDHandler = onto.ontoCompare(targetOntoUrl, sourceOntoUrl);
When I compile and run my client, it throws the following error -
java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.ja
va:497)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294
at sstub.OntoIF_Stub.echoDataHandler(OntoIF_Stub.java:122)
at sstub.OntoClient.main(OntoClient.java:63)
Can you please let me know what I am doing wrong? I have no problems in sending a DataHandler but receiving the DataHandler from the web service throws errors.
Thanks!Hi I'm having the same problem. I try to set up a Web Service using JAX_RPC. My WS should invoke a native Method implemented in C++. Did you got a solution for this issue? My Error Message is as follows:
java.rmi.ServerException: JAXRPCSERVLET28: Missing port information
at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:497)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:294)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:80)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:489)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:122)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:86)
at $Proxy0.getHello(Unknown Source)
at com.neuhaus.test.ws.client.NativeInvokeClient.main(NativeInvokeClient.java:44)
Exception in thread "main"
greetings, JAN -
Error returning large String arrays from web service
Hi,
I currently have an EJB that returns a String[] array that I have implemented as
a Web Service. When I execute a Java client (JSP) from Weblogic, I don't have a problem
as long as the returned array is relatively small, but when the array starts to get
a little larger (say 20 elements, about 30 chars each), I consistently get:
SAXException: java.lang.IllegalArgumentException:array element type mismatch.
Strangely enough, when my web service client is a .asp page running under MS IIS
(using the MS SOAP Toolkit), it works fine. I have returned as many as 15000 - 20000
array elements in one call. And since I am calling the same Weblogic EJB with the
MS client, I know it's a problem with the Java client, not the EJB.
Anybody know of a bug or had this experience before? Or know what I might be doing
wrong? FYI, I am using Weblogic 6.1 SP2.
Thanks,
SteveHi Steve,
Sure we're interested...I'll pass this along to the XML folks.
Thanks for the feedback,
Bruce
Steve Alexander wrote:
In case anyone is interested, I solved my problem. I was mis-diagnosing the problem
- thinking it was a size issue when it actually was a data issue. On the calls where
I was returning a large array, some of the array members were null. When I made them
enpty strings "", it worked. Apparently the default SAX parser BEA uses doesn't like
the nulls, whereas the MS parser doesn't care.
"Steve Alexander" <[email protected]> wrote:
Thanks Bruce,
FYI - I have reproduced the problem on WL7.0. I have turned it in to support
as you
suggested.
Steve
Bruce Stephens <[email protected]> wrote:
Hi Steve,
This does not ring any bells, however I would suggest that you file a support
case. If it
is an option you might try a later release (7.0).
Bruce
Steve Alexander wrote:
Hi,
I currently have an EJB that returns a String[] array that I have implementedas
a Web Service. When I execute a Java client (JSP) from Weblogic, I don'thave a problem
as long as the returned array is relatively small, but when the arraystarts to get
a little larger (say 20 elements, about 30 chars each), I consistentlyget:
SAXException: java.lang.IllegalArgumentException:array element type mismatch.
Strangely enough, when my web service client is a .asp page running underMS IIS
(using the MS SOAP Toolkit), it works fine. I have returned as many as15000 - 20000
array elements in one call. And since I am calling the same Weblogic
EJB
with the
MS client, I know it's a problem with the Java client, not the EJB.
Anybody know of a bug or had this experience before? Or know what I mightbe doing
wrong? FYI, I am using Weblogic 6.1 SP2.
Thanks,
Steve -
How to return List or Array from Web Service without using ADF?
All,
I would like to know how to do this before I use ADF. Sounds like a simple thing to do - common even - but I haven't found a solution in existing postings. My attempts have failed though I'm not sure exactly why.
I have created a declarative WS that takes a single parameter and tries to return a List<Employees> resultset. My Sample Java Client works just fine. When I change the result type from List to String[], for example, it also works fine.
What am I doing wrong??
Thanks
package wizard;
(imports removed for readability)
@WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
@Deployment(restSupport = true)
public class HelloWorld {
List<Employees> employees = null;
public HelloWorld() {
public List<Employees> sayHello (String s) {
try {
final Context context = getInitialContext();
ATOABPFacade aTOABPFacade = (ATOABPFacade)context.lookup("ATOABPFacade");
employees = aTOABPFacade.queryEmployeesFindByName(s);
return employees;
} catch (Exception ex) {
ex.printStackTrace();
return employees;
private static Context getInitialContext() throws NamingException {
return new InitialContext();
Trace:
Ready message received from Oc4jNotifier.
Embedded OC4J Server startup time: 24063 ms.
Target URL -- http://localhost:8988/JPA-Wizard-context-root/mywebservice1soaphttpport
Feb 18, 2008 7:42:49 PM com.evermind.server.ServerBase log
WARNING: JPA-Wizard-webapp: Error preloading servlet
javax.servlet.ServletException: java.lang.NullPointerException
at oracle.j2ee.ws.server.provider.ProviderServlet.init(ProviderServlet.java:186)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2674)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5162)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5085)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5275)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1357)
at com.evermind.server.http.HttpApplication.init(HttpApplication.java:873)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:699)Gi,
not sure what you are doing there, but you can build the J2EE WebService from your working POJO, and create a Web Service proxy class from the WSDL description (of the deployed or local WSDL file). Then, using the proxy class, you can access the output of the WebService.
Frank -
Can objects returned from web services be cast to strongly typed objects?
Can objects returned from web services be cast to strongly
typed objects?
Last I tried this was with one of the beta of Flex2 and it
did not work. You had to use ObjectProxy or something like that...
ThanksPlease post this question in the CRM On Demand Integration Development forum.
-
Facing problem while going to catch return result from web-services.
Hi everybody,
I am new to BPEL. I am facing problem while going to catch the attributes of resultsets returning from web-services(QAS). As far as my knowledge, two types of results it should return - XML entities and another is attributes which is coming as the part of XML entitites. I am able to catch the XML entities, but can't catch the attributes under it. Even, I am not able to see whether web-services returning something within that field.
When, I tried to catch the attribute and store to a temporary varilable using the following code:
*<assign name="AssignQASDoGetAddress1">*
*<copy>*
*<from variable="InvokeQAS_DoSearch_OutputVariable"*
part="body"
query="/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded"/>
*<to variable="temp"/>*
*</copy>*
*</assign>*
but, I am facing the following selectionFailure errors after running it:
*"{http://schemasxmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.*
-<selectionFailure xmlns="http://schemasxmlsoap.org/ws/2003/03/business-process/">
-<part name="summary">
*<summary>*
empty variable/expression result.
xpath variable/expression expression "bpws:getVariableData('InvokeQAS_DoSearch_OutputVariable', 'body', '/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded')" is empty at line 269, when attempting reading/copying it.
Please make sure the variable/expression result "bpws:getVariableData('InvokeQAS_DoSearch_OutputVariable', 'body', '/ns6:QASearchResult/ns6:QAPicklist/ns6:PicklistEntry/@PostcodeRecoded')"is not empty.
*</summary>*
*</part>*
*</selectionFailure>*
Getting this error it seems to me that web-service is returning nothing, but, it returns something as it has been catched using a method called isPostcodeRecoded() Java Code in Oracle ADF. This method has been used as it should return boolean whereas for catching the xml entities using java code we used the method like getPostcode(), getMoniker().
For your information, we are using Jdeveloper as the development tool for building the BPEL process.
Am I doing any syntax error. Please consider it as urgent and provide me asolution.
Thanks in advance.
Chandrachur.Thanks Dave and Marc, for your suggestions. Actually what I found is QAS web-service is returning nothing as attributes when the attributes are set to the default value. For example, following is the part of the wsdl of the result which QAS webservice returns.
<xs:element name="QASearchResult">
- <xs:complexType>
- <xs:sequence>
<xs:element name="QAPicklist" type="qas:QAPicklistType" minOccurs="0" />
<xs:element name="QAAddress" type="qas:QAAddressType" minOccurs="0" />
</xs:sequence>
<xs:attribute name="VerifyLevel" type="qas:VerifyLevelType" default="None" />
</xs:complexType>
</xs:element>
<xs:complexType name="QAPicklistType">
- <xs:sequence>
<xs:element name="FullPicklistMoniker" type="xs:string" />
<xs:element name="PicklistEntry" type="qas:PicklistEntryType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Prompt" type="xs:string" />
<xs:element name="Total" type="xs:nonNegativeInteger" />
</xs:sequence>
<xs:attribute name="AutoFormatSafe" type="xs:boolean" default="false" />
<xs:attribute name="AutoFormatPastClose" type="xs:boolean" default="false" />
<xs:attribute name="AutoStepinSafe" type="xs:boolean" default="false" />
<xs:attribute name="AutoStepinPastClose" type="xs:boolean" default="false" />
<xs:attribute name="LargePotential" type="xs:boolean" default="false" />
<xs:attribute name="MaxMatches" type="xs:boolean" default="false" />
<xs:attribute name="MoreOtherMatches" type="xs:boolean" default="false" />
<xs:attribute name="OverThreshold" type="xs:boolean" default="false" />
<xs:attribute name="Timeout" type="xs:boolean" default="false" />
</xs:complexType>
<xs:complexType name="PicklistEntryType">
- <xs:sequence>
<xs:element name="Moniker" type="xs:string" />
<xs:element name="PartialAddress" type="xs:string" />
<xs:element name="Picklist" type="xs:string" />
<xs:element name="Postcode" type="xs:string" />
<xs:element name="Score" type="xs:nonNegativeInteger" />
</xs:sequence>
<xs:attribute name="FullAddress" type="xs:boolean" default="false" />
<xs:attribute name="Multiples" type="xs:boolean" default="false" />
<xs:attribute name="CanStep" type="xs:boolean" default="false" />
<xs:attribute name="AliasMatch" type="xs:boolean" default="false" />
<xs:attribute name="PostcodeRecoded" type="xs:boolean" default="false" />
<xs:attribute name="CrossBorderMatch" type="xs:boolean" default="false" />
<xs:attribute name="DummyPOBox" type="xs:boolean" default="false" />
<xs:attribute name="Name" type="xs:boolean" default="false" />
<xs:attribute name="Information" type="xs:boolean" default="false" />
<xs:attribute name="WarnInformation" type="xs:boolean" default="false" />
<xs:attribute name="IncompleteAddr" type="xs:boolean" default="false" />
<xs:attribute name="UnresolvableRange" type="xs:boolean" default="false" />
<xs:attribute name="PhantomPrimaryPoint" type="xs:boolean" default="false" />
</xs:complexType>
here the attributes like FullAddress, PostcodeRecodedare , etc. are not being return by the web-service when it is getting the default value false. But, if it gets true then , it is being displayed at the BPEL console.
Do you have any idea how can I catch the attributes and its value even when it gets the default value which is already set. Previously, it was returning(it was not being displayed at the console).
Thanks once again for your valuable suggestions...!!!
Chandrachur. -
Unable to download object schema from Web services administration
Hi,
When I try to download generic/custom schema for Account/Contact/Campaign/Opportunity from Admin->web services administration , I get the following error:
Schema file generation for the requested object in Web Services v2.0 is not currently supported in CRM On Demand.
Why? I tried for some other objects as well, with the same result. How can I get the custom/generic schema for objects and how can I get the object model diagram for Oracle CRM OnDemand?
Regards,Please post this question in the CRM On Demand Integration Development forum.
-
Binding xml from web service to java objects
I would appreciate if someone can tell me where can i get information regarding
binding of xml from web service to java objects in weblogic 6.1 .
Thanks,
agHi Ag,
To my knowledge, the only information on this topic is whatever you find in the
documentation. What exactly do you want to know?
Can you post a set of specific questions?
Regards,
Mike Wooten
"ag" <[email protected]> wrote:
>
I would appreciate if someone can tell me where can i get information
regarding
binding of xml from web service to java objects in weblogic 6.1 .
Thanks,
ag -
Hi,
I'm currently trying to consume in VC a CAF Application Service exposed as a Web Service. I'm able to retrieve what I want but I have a problem with dates format.
The web service returns dates in the following format: YYYY-MM-DDTHH:NN:SS
When I test my data service in VC it works fine. When I run my iview, VC swap the month and the day and compute the new date...
It's not just a problem of formatting with DVAL and DSTR because the date is already computed.
Example:
Date returned from web service: 2007-09-21T00:00:01
Date returned from test data service in VC: 21.09.2007
Date returned at runtime: 09.09.2008
VC understand 21.09.2007 not like DD.MM.YYYY but like MM.DD.YYYY so 21.09.2007 becomes 09.09.2008
I also tried to check on the server Regional and Language option but it doesn't come from there.
Have you ever faced this problem?
ThxHi,
It is a Web Service generated by NWDS (to expose my CAF Application Service)and deployed on the server.
The url si like http://<hostname>:<port>/mywebservice/Config1?wsdl
The Web Service runs correctly.
When I call a method of my web service to retrieve a list of objects (CAF Entity Services) and their attributes, it returns attributes of type String and Dates of type 'java.util.GregorianCalendar'.
It seems that VC doesn't correctly understand this type of Date at runtime
Regards,
Thomas -
Set listbox items from web service response
Hi All
I am trying to set list box items from a web service response. Couple of issues over here:
1. The user should be able to select multiple items from the list. Hence if I set "Allow multiple values" and set Commit on "exit", then after the web service returns the output, no data is displayed in the listbox. I need to click inside the list box to see the data returned by the web service. How to overcome this..?? ( However this problem (clicking inside the listbox to see the items) does not exist if "Allow multiple values" is unchecked and Commit is set on "Select". )
2. After the list box is filled up, certain default values should be selected. This selection is based on one of the response field (which is actually a table with multiple values... ). Hence, how to capture this response field and set the default values in the above list..??
3. The same case for a dropdown. The values are visible in dropdown. However, a default value should be selected and displayed after returning a response from web service. Again, this default value is dependant on another field in the response as in point no.2
I am trying to use postExecute event as described in [this|http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/] link...however not able to achieve the functionality. Please provide suggestions / inputs.
Thanks
DeepakHello,
first: I don´t know anything about the right solution. I am unaware of the existence of the solution, because there were quite many of question about this multiple selection problem and I don´t remember a single "answer".
I can recommend you to simplify everything and create the functionality yourself. I have done that before to avoid these "Adobe-standard" problems. If you have a problem with autofill of the object, ask your WS to send you a single string and pass it yourself using scripting (JS).
And if you have problems with multiple selection, create your own field/ object. Get the string of values, parse it, create multiple lines of the dynamic table with some suitable tool to check/ select the rows you need (use checkbox for example, and your text as a table row). This way you can selected anything you want with no problems at all. It wil only cost you some extra work.
Regards, Otto
Maybe you are looking for
-
How do i Sync Notes from iPhone to MacBook Pro?
In Lion I connected my iPhone to my MacBook Pro and then it auto sync Notes to my e-mail account. Now after I got Mountain Lion it's not auto sync of Notes anymore and I wonder what I must do to achieve this? What's on Notes today are old notes that
-
Share music and apps in one household
Just got my wife an iPhone. I've had one for years. Can we share music and apps I have purchased?
-
Authorization object for Object services
Hello together, I want to know if there is an authorization object for Generic object services functionilty especially the WF options like WF overview, start WF, Archieve WF.............................. My understanding is any user who has access to
-
I am trying to disable my pop up's in order to allow an address so I can change the address on my drivers license. When I enter the address that allows the document that I need to appear, I get, "what is the host name? I don't know what they mean by
-
The Apple av cables are awesome. They look great and also give a really crisp picture when connecting the video ipod to a t.v. However if your t.v is more than 25 cm from where you plug in the audio leads then make sure you get a coupler and a photo