tien liu

Greenhorn
+ Follow
since Dec 13, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tien liu

Thanks for your prompt reply. As you said, I added
set CLASSPATH=.;..;
set PATH=%PATH%;"D:\j2sdk1.4.1_01\bin"
doskey
and it's working fine.
Thanks.
Tien
17 years ago
Hi,
I've never had any problem executing my class files using command line when it's anything below jdk1.4. I got java.lang.NoClassDefFoundError when using 1.4 versions. And I'm sure that Now.class is in D:\Java directory.
The Now.class executes fine when I use 1.3.
This is my batch file, jdk14101setup.bat :
set PATH=%PATH%;"D:\j2sdk1.4.1_01\bin"
doskey

D:\Java>jdk14101setup.bat
D:\Java>set PATH=;D:\jwsdp-1_0_01\bin;D:\j2sdk1.4.1_01\bin;D:\Iona\bin;D:\jdk1.3.0_02;"D:\j2sdk1.4.1_01\bin"
D:\Java>javac Now.java
D:\Java>java Now
Exception in thread "main" java.lang.NoClassDefFoundError: Now
This is Now.java:
import java.util.*;
public class Now
{
public static void main(String[] args)
{
Date now = new Date();
long nowLong = now.getTime();
System.out.println("value is " + nowLong );
}
}
Thanks for your help.
Tien
17 years ago
Hi Jean-Louis,
Je suis vraiment choque aussi. Je ne pige pas du tout pourquoi je dois ajouter le deserializer. As you stated, it's a simple String data type.
I tried your code: call.setReturnType(XMLType.XSD_STRING);
Where do you get XMLType.XSD_STRING? The compiler can't find it, and it's not in xerces.jar or soap.jar.
Salut.
Tien
17 years ago
Hi,
Thanks for your responses. I did figure out the problem and fix it.
I turns out I do have to deserialize the return by adding this code to the class that invokes the web service:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "return"), null, null, sd);
call.setSOAPMappingRegistry(smr);
It has to do with the xsi:type, which is seen as "the most common interop problem." The Apache soap puts the xsi:type elements for all parameters in the request. But, the xsi:type is missing in the response, which includes result or return.
When the xsi:type attribute of the result or return element is missing, the error message will say "SOA-ENV:Client;No deserialization found....."
The solution is to add code to deserialize the return.
The xsi:type problem does not show up when I run the application within WSAD 4.1.1. It only shows up when I run the client outside it.
I hope this will help others to solve the deserialization problem on the client side. If it happens on the server side, you'll need to add the deserialization stuff in the deployment descriptor.
Thanks for your help. You ranchers are a bunch of great guys.
Thanks.
Tien
17 years ago
Hi,
I don't have a direct answer to your question, but had a jit error when running my app on jakarta-tomcat and using jdk122. Check out the link below for IBM's explanation of jit.
http://www-1.ibm.com/servers/esdd/articles/porting_java/
Tien
17 years ago
Hi,
I'm using WSAD 4.11 and jakarta-tomcat-3.2.4. Is there any way to see the soap request and soap response when running an application?
I'm asking this question because it seems the request includes the xsi:type element and the response doesn't.
Thanks in advance.
Tien
17 years ago
Thanks for suggesting to use TCPMON utility in apache axis. I'm using WSAD 4.1.1 (Websphere server). Is there a similar utility in WSAD?
Tien
17 years ago
Thanks for your prompt response. It's a String.

<message name="authenticateResponse">
<part name="result" type="xsd:string"/>
</message>

AuthenticationService7-binding.wsdl (Websphere 4.1.1):
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="AuthenticationService7-binding"
targetNamespace="http://www.authenticationservice7.com/definitions/AuthenticationService7RemoteInterface"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.authenticationservice7.com/definitions/AuthenticationService7RemoteInterface" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="authenticateRequest">
<part name="ldapURL" type="xsd:string"/>
<part name="uid" type="xsd:string"/>
<part name="ouString" type="xsd:string"/>
<part name="oString" type="xsd:string"/>
<part name="pwd" type="xsd:string"/>
<part name="ldapBase" type="xsd:string"/>
<part name="ldapFilter" type="xsd:string"/>
</message>
<message name="authenticateResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="AuthenticationService7">
<operation name="authenticate" parameterOrder="ldapURL uid ouString oString pwd ldapBase ldapFilter">
<input message="tns:authenticateRequest" name="authenticateRequest"/>
<output message="tns:authenticateResponse" name="authenticateResponse"/>
</operation>
</portType>
<binding name="AuthenticationService7Binding" type="tns:AuthenticationService7">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="authenticate">
<soap peration soapAction="" style="rpc"/>
<input name="authenticateRequest">
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://atl.frb.org/AuthenticationService7" use="encoded"/>
</input>
<output name="authenticateResponse">
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://atl.frb.org/AuthenticationService7" use="encoded"/>
</output>
</operation>
</binding>
</definitions>
17 years ago
Hello,
I've deployed the web service on the server, and I've been trying to get a message back from it. But I got the error message below.
Any help is appreciated.
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserial
ize a ':return' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'
.; targetException=java.lang.IllegalArgumentException: No Deserializer found to
deserialize a ':return' using encoding style 'http://schemas.xmlsoap.org/soap/en
coding/'.]
Here's the client code:
import java.net.*;
import java.util.*;
import org.w3c.dom.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.messaging.*;
public class AuthenticationService7Proxy
{
private Call call = new Call();
private URL url = null;
private String stringURL = "http://xxxx/Auth7/servlet/rpcrouter";
private SOAPMappingRegistry smr = call.getSOAPMappingRegistry();

public AuthenticationService7Proxy()
{
}
public synchronized void setEndPoint(URL url)
{
this.url = url;
}
public synchronized URL getEndPoint() throws MalformedURLException
{
return getURL();
}
private URL getURL() throws MalformedURLException
{
if (url == null && stringURL != null && stringURL.length() > 0)
{
url = new URL(stringURL);
}
return url;
}
public synchronized java.lang.String authenticate(java.lang.String ldapURL,java.lang.String uid,java.lang.String ouString,java.lang.String oString,java.lang.String pwd,java.lang.String ldapBase,java.lang.String ldapFilter) throws Exception
{
String targetObjectURI = "http://xxx/AuthenticationService7";
String SOAPActionURI = "";

String message = null;
if(getURL() == null)
{
throw new SOAPException(Constants.FAULT_CODE_CLIENT,
"A URL must be specified via AuthenticationService7Proxy.setEndPoint(URL).");
}
call.setMethodName("authenticate");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI(targetObjectURI);
Vector params = new Vector();
Parameter ldapURLParam = new Parameter("ldapURL", java.lang.String.class, ldapURL, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapURLParam);
System.out.println("added ldapURL parameter");
Parameter uidParam = new Parameter("uid", java.lang.String.class, uid, Constants.NS_URI_SOAP_ENC);
params.addElement(uidParam);
Parameter ouStringParam = new Parameter("ouString", java.lang.String.class, ouString, Constants.NS_URI_SOAP_ENC);
params.addElement(ouStringParam);
Parameter oStringParam = new Parameter("oString", java.lang.String.class, oString, Constants.NS_URI_SOAP_ENC);
params.addElement(oStringParam);
Parameter pwdParam = new Parameter("pwd", java.lang.String.class, pwd, Constants.NS_URI_SOAP_ENC);
params.addElement(pwdParam);
Parameter ldapBaseParam = new Parameter("ldapBase", java.lang.String.class, ldapBase, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapBaseParam);
Parameter ldapFilterParam = new Parameter("ldapFilter", java.lang.String.class, ldapFilter, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapFilterParam);
System.out.println("added ldapFilter parameter");
call.setParams(params);
System.out.println("setParams");
System.out.println("before call invoke");
Response resp = call.invoke(getURL(), SOAPActionURI);
System.out.println("Response");
//Check the response.
if (resp.generatedFault())
{
System.out.println("Response generated fault");
Fault fault = resp.getFault();
call.setFullTargetObjectURI(targetObjectURI);
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
else
{
Parameter refValue = resp.getReturnValue();
return ((java.lang.String)refValue.getValue());

}

}

}

Thanks.
Tien
17 years ago
Hi,
I'm running WSAD 4.1.1 on Windows 2000. I've tested my own service code and the WForecast example that I downloaded from IBM. Both web services run fine in WSAD. Now, I want to publish them to the LOCAL UDDI Registry.
However, I keep getting the same error message below.
Where and how do I set the userID and password? Where's the wstkProperties.xml? I searched the WSAD directory and couldn't find it. Is there another way to publish web services to the LOCAL UDDI registry?

IWAB0104E Login to registry Local UDDI failed.
Could not enable Publish Interface.
------------------------------------------------------------------------------
Nested exception is:
com.ibm.wstk.service.registry.ServiceRegistryProxyException: Error getting authentication token for [userid: uddiUser, cred: uddiPwd]. Verify that the UDDI userid and cred settings are correct in the wstkProperties.xml file.
------------------------------------------------------------------------------
Nested exception is:
[SOAPException: faultCode=SOAP-ENV rotocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:
The page cannot be displayed The page you are looking for cannot be displayed because the page address is incorrect. --------------------------------------------------------------------------------Please try the following:If you typed the page address in the Address bar, check that it is entered correctly.Open the localhost:1210 home page and then look for links to the information you want. HTTP 405 - Resource not allowedInternet Information Services
Thanks for your help in advance.
Tien
17 years ago
Hi,
Could someone give me some pointers on the problem below?
1. I've set up a web service that authenticates the user id and password. I'm using Sun's ldap jars (jndi.jar, ldapsec.jar, ldapbp.jar, ldap.jar).
2. Everything works fine, but twice the user couldn't log on to the application and the following error message was found in the log:
>>(Tue Jun 17 10:56:56 EDT 2003) Processing SOAP request...
olRunnable@149B9A0/161D958: <unowned>
Waiting to be notified:
"Thread-18" (0x5bb55e8)
Registered Monitor Dump:
SymcJIT Method Monitor: <unowned>
SymcJIT Method Monitor: <unowned>
SymcJIT Lazy Queue Lock: <unowned>
Waiting to be notified:
"SymcJIT-LazyCompilation-0" (0x4a1b760)
"SymcJIT-LazyCompilation-1" (0x4a177d8)
SymcJIT Method Monitor: <unowned>
SymcJIT Method List Monitor: <unowned>
SymcJIT Lock: <unowned>
utf8 hash table: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class linking lock: <unowned>
System class loader lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor cache lock: owner "Signal dispatcher" (0x4959c00) 1 entry
Thread queue lock: owner "Signal dispatcher" (0x4959c00) 1 entry
Waiting to be notified:
"Thread-24" (0x2f41e8)
Monitor registry: owner "Signal dispatcher" (0x4959c00) 1 entry
A nonfatal internal JIT (3.10.107(x)) error 'chgTarg: Conditional' has
occurred in :
'com/sun/jndi/ldap/Connection.unpauseReader ()V': Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi
A nonfatal internal JIT (3.10.107(x)) error 'chgTarg: Conditional' has
occurred in :
'com/sun/jndi/ldap/Connection.readReply
(Lcom/sun/jndi/ldap/LdapRequest Lcom/sun/jndi/ldap/BerDecoder;':
Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cgi

3. Here's the code:
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* This class implements the AuthenticateIF interface and authenticates the user id and password against LDAP.
* It returns an authentication success or failure message to AuthenticateClient.
* @version 1.0
* 11/14/02 web service
*/
public class AuthenticateImpl implements AuthenticateIF
{
public String errorMessage = "1, Authtentication failed";
public String successMessage = "0, Authentication successful";
public String processAuthenticate(String ldapURL, String uid, String ouString, String oString, String pwd, String ldapBase, String ldapFilter)
{
DirContext ctx = null;
try
{
// create an environment for the initial directory context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,ldapURL);
System.out.println("start Security");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "uid=" + uid + ", " + ouString + ", " + oString); // "uid=" + uid + ", ou=xxx, o=xxxx"
env.put(Context.SECURITY_CREDENTIALS, pwd);
System.out.println("end Security");
// create the initial directory context
ctx = new InitialDirContext(env);
String base = ldapBase; //"cn=xxx,ou=xxxx,o=xxxxx"
String filter = ldapFilter; // "objectclass=groupOfUniqueNames"
// set up and perform the search
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
constraints.setTimeLimit(2000);
String attrList[] = { "cn,uniquemember" };
constraints.setReturningAttributes(attrList);
NamingEnumeration results = ctx.search(base, filter,constraints);
// ctx.close();
// print the search results
if (!results.hasMore())
{
return uid + pwd + " and " + errorMessage;
}
else
{
// for each entry found
while (results.hasMore())
{
SearchResult sr = (SearchResult) results.next();
System.out.println(sr.getName());
Attributes attrs = sr.getAttributes();
if (attrs == null)
{
return errorMessage;
}
else
{
// For each attribute of the entry
for (NamingEnumeration ae = attrs.getAll(); ae.hasMore()
{
Attribute attr = (Attribute) ae.next();
String id = attr.getID();
// for each value of the attribute
for(Enumeration vals = attr.getAll(); vals.hasMoreElements();
System.out.println(" " + id + ": " + vals.nextElement()));
}
return successMessage;
}
}
}
return successMessage;
}
catch(NamingException ne)
{
// handle any name/directory exceptions
//System.out.println("Authentication failed: " + ne.getMessage());
return "Authentication failed: " + ne.getMessage();
}
catch(Exception e)
{
// handle any other types of exceptions
//System.err.println("Non-naming error: " + e.getMessage());
return "Non-naming error: " + e.getMessage();
}
} // end of processAuthenticate
} // end of AuthenticateImpl

Any help would be greatly appreciated.
Thanks.
Hi,
Can someone give me some pointers on the problem below?
1. The following code ran fine when I used jdk1.3.0_02 because the sun/net/ftp/FtpInputStream.class is in the rt.jar of jdk1.3.0_02:
FtpInputStream is =(FtpInputStream) ftp.get(sourceFile);
FileOutputStream os = new FileOutputStream (file_out);
while((c= is.read(bytes))!=-1) {
total_bytes +=c;
os.write(bytes,0,c);
}
2. When I switched to j2sdk1.4.0_02, the code failed because the sun/net/ftp/FtpInputStream.class has been removed from the rt.jar of j2sdk1.4.0_02.
Any ideas on how to fix that?
Thanks in advance.
Hi Michael,
Please ignore my last question. The code you sent me works great.
17 years ago
Hi Michael,
Thanks for the code. It works great for converting a vector of vectors into a double array.
Could you tell me what part of the code to modify for converting a vector (with two values each row) into a double array?
output example: [[BOST, 3]]
Thanks.
17 years ago
Hi,
Could someone please give me pointers on how to convert a vector of vectors into a two-dimensional array?
Each sBank and dBank consists of a name and a number. Output example from the method below:
parseBankPairNames = [[SEAT, 48, SANF, 47, SALT, 46,], [BOST, 3]]
public Vector parseBankPairNames(String sBank, String dBank {
Vector origin = parseBankName(sBank, dBank),
destin = parseBankName(dBank, sBank);
Vector v = new Vector();
v.addElement(origin);
v.addElement(destin);
System.out.println("parseBankPairNames = " + v.toString());

return v;
}
}
Thanks for your help.
17 years ago