You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2007/03/02 05:46:50 UTC

[jira] Commented: (AXIS2-2278) Having problems with vectors in my web service

    [ https://issues.apache.org/jira/browse/AXIS2-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477184 ] 

Deepal Jayasinghe commented on AXIS2-2278:
------------------------------------------

Hi 

We do not support Vectors , why dont you try ArrayList or Object array ?

Thanks
Deepal

> Having problems with vectors in my web service
> ----------------------------------------------
>
>                 Key: AXIS2-2278
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2278
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>            Reporter: Panayiotis Petridis
>
> Hi, 
> I have a web service on axis 2 which is called by an RPCClient. My problem is that because my Web service calls a class which contains a vector i get the null rcl Exception and specific on StAXOMBuilder.
> My RPCClient is:
> --------------------------------
> package com.something;
> import javax.xml.namespace.QName;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.Options;
> import org.apache.axis2.rpc.client.RPCServiceClient;
> public class RPCClient {
> 	public static void main(String [] args1 ) throws AxisFault {
> 		RPCServiceClient serviceClient = new RPCServiceClient();
> 		Options options = serviceClient.getOptions();
> 		EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");
> 		
> 		options.setTo(targetEPR);
> 		
> 		SLTerm sl = new SLTerm();
> 		sl.setBd("bd");
> 		sl.setName("name");
> 		sl.setSCr("sc");
>                 SL newsl = new SL();
>                 newsl.setPart("Part");
> 		QName opAddElement = new QName("http://xmldb/xsd", "Ins");
> 		Object[] opAddElementArgs = new Object[] { newsl };
> 		serviceClient.invokeRobust(opAddElement, opAddElementArgs);
> }
>  sl class:
> ----------------
> package com.something;
> import java.util.*;
> public class SL {
> 	private Vector<SLTerm> terms = new Vector<SLTerm>();
> 	private String part = null;
> 	public void addTerm(SLTerm newTerm) {
> 		terms.addElement(newTerm);
> 	}
> 	public Vector<SLTerm> getTerms() {
> 		return terms;
> 	}
> 	public String getPart() {
> 		return party;
> 	}
> 	public void setPart(String part) {
> 		this.part = part;
> 	}
> }
> SLTerm class
> ---------------------
> package com.something;
> public class SLTerm {
> 	private String bd = null;
> 	private String name = null;
> 	private String s_cri = null;
> 	
> 	
> 	public void setBd(String bid) {
> 		this.bd = bd;
> 	}
> 	public String getBd() {
> 		return bid;
> 	}
> 	public void setName(String name) {
> 		this.name = name;
> 	}
> 	public String getName() {
> 		return name;
> 	}
> 	public void setSCr(String sc) {
> 		this.s_cri = sc;
> 	}
> 	public String getSCr() {
> 		return s_cri;
> 	}
> }
> Service:
> ---------------
> package com.something;
> public class DBService {
> 	public void Ins(SL sl) {
> 		new Insert(sl.getTerms());
> 	}
> }
> Insert class
> -------------------
> package com.something;
> import java.io.*;
> import java.util.Vector;
> import javax.xml.parsers.DocumentBuilder;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.parsers.ParserConfigurationException;
> import javax.xml.transform.Result;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerConfigurationException;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> //import org.w3c.dom.DocumentType;
> import org.w3c.dom.Element;
> public class Insert {
> 	public Insert(Vector<SLATerm> terms) {
> 			SL sl = new SL();
> 			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = null;
> 			try {
> 				db = dbf.newDocumentBuilder();
> 			} catch (ParserConfigurationException e1) {
> 				e1.printStackTrace();
> 			}
> 			Document document = db.newDocument();
> 			Element QoSdb = document.createElement("QoSdb");
> 			document.appendChild(QoSdb);
> 			for (SLATerm term : terms) {
> 				Element OfferType = document.createElement("OfferType");
> 				Element Part = document.createElement("Party");
> 				Part.appendChild(document.createTextNode(sl.getPart()));
> 				OfferType.appendChild(Part);
>                                 Element bd = document.createElement("Bd");
> 				bd.appendChild(document.createTextNode(term.getBd()));
> 				OfferType.appendChild(bd);
>                                 Element name = document.createElement("Name");
> 				name.appendChild(document.createTextNode(term.getName()));
> 				OfferType.appendChild(name);
> 				Element sc = document.createElement("SC");
> 				sc.appendChild(document.createTextNode(term.getSCr()));
> 				OfferType.appendChild(sc);
> 				QoSdb.appendChild(OfferType);
>                                 
> 			}
> 			// Saving the document on a specific dir
> 			String test = "/home/ntua/Test/test.xml";
> 			String docName = "test.xml";
> 			TransformerFactory tf = TransformerFactory.newInstance();
> 			Transformer transformer = null;
> 			try {
> 				transformer = tf.newTransformer();
> 			} catch (TransformerConfigurationException e) {
> 				e.printStackTrace();
> 			}
> 			DOMSource source = new DOMSource(document);
> 			Result dest = new StreamResult(new File(test));
> 			try {
> 				transformer.transform(source, dest);
> 			} catch (TransformerException e) {
> 				e.printStackTrace();
> 			}
> 			
> 	} // End insert
> }
> As you imagine i save an xml document created by the rpc client using the values of the vector
> I get the null rcl exception... If anyone could help .... Thanks

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org