Hi Scott ,
Sorry and im printing
DOM2Writer.nodeToString(custID); also getting the
value as excepted and passing to my Service..
Now im not getting values from database
Error like this ,
In Service .....DB connection......
[EMAIL PROTECTED]
java.sql.SQLException: [Microsoft][ODBC SQL Server
Driver][SQL Server]Invalid column name 'id: null'.
at
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
id is the root element i have given and getting from
client....
***************************************************
Here my Service code
public Element getCustomerInfo(Element customerId)
throws IllegalArgumentException
{
customerId = customerId;
System.out.println( "STRXML = " +
DOM2Writer.nodeToString(customerId));
// getting Connection
try
{
dba = new DBAdapter();
conn = dba.getConnection();
stmt = conn.createStatement();
String SQLStatement = ("Select * from
CustomerProfile where id="+customerId);
rs = stmt.executeQuery(SQLStatement);
if (rs != null)
{
while(rs.next())
{
custId = rs.getString("id");
name = rs.getString("name");
phone =rs.getString("phone");
}
}
stmt.close();
conn.close();
}
catch(Exception e){
e.printStackTrace();
System.out.println("SQL.Exception Inside
CATCH SVC.."+e);
}
try {
nameE.appendChild( doc.createTextNode(name));
root.appendChild(nameE);
phoneE.appendChild( doc.createTextNode(phone));
root.appendChild(phoneE);
custidE.appendChild( doc.createTextNode(custId) );
root.appendChild(custidE);
doc.appendChild( root );
OutputFormat format = new OutputFormat( doc );
XMLSerializer serial = new XMLSerializer(
stringOut, format );
serial.asDOMSerializer();
serial.serialize( doc.getDocumentElement() );
System.out.println( "STR XML = " +
DOM2Writer.nodeToString(root) );
}
catch ( Exception ex ) {
ex.printStackTrace();
}
return root;
}
*****************************************************
Client code:
public Element callCustSVC(String IdToLookup) throws
Exception
{
IdToLookup = IdToLookup;
System.out.println("IdToLookup in
GetCustInfo..callCustSVC ----"+IdToLookup + "\n");
call = new Call();
String soapActionURI ="";
smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
smr = call.getSOAPMappingRegistry();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("urn:CustInfoFetcher");
call.setMethodName("getCustomerInfo");
call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
smr.mapTypes(Constants.NS_URI_LITERAL_XML,
new
QName("urn:xml-soap-customer-demo","Customer"),
Element.class, null, null);
try {
custID.appendChild( doc.createTextNode(IdToLookup) );
root.appendChild(custID);
doc.appendChild( root );
OutputFormat format = new OutputFormat( doc );
XMLSerializer serial = new XMLSerializer(
stringOut, format );
serial.asDOMSerializer();
serial.serialize( doc.getDocumentElement() );
System.out.println( "STRXML = " + stringOut.toString()
);
stem.out.println(DOM2Writer.nodeToString(custID));
//Spit out DOM as a String
}
catch ( Exception ex ) {
ex.printStackTrace();
}
this.url = new
URL("http://10.1.1.237:8080/soap/servlet/rpcrouter");
Vector params = new Vector();
params.addElement(new Parameter("IdToLookup",
Element.class,
custID,
Constants.NS_URI_LITERAL_XML));//
call.setParams(params);
//
try
{
resp = call.invoke(url, soapActionURI);
System.out.println("RESPONSE__________________
INN "+resp);
}
catch (SOAPException e)
{
e.printStackTrace();
}
//Test Response fault..
if (!resp.generatedFault())
{
Parameter ret = resp.getReturnValue();
custID = (Element)ret.getValue();
System.out.println(DOM2Writer.nodeToString(custID));
}
else
{
Fault fault = resp.getFault();
System.err.println("Generated fault: " + fault);
}
//Returning Element
return custID;
}
*******************************************************
i couldn't find out whether problem in client or
service...
Expectinmg to hear from you
Thanks and regards
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com