Praveen Babu

Ranch Hand
+ Follow
since Jul 30, 2006
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 Praveen Babu


Hi Paul,

Thank you for the inputs. I do realize that converting byte[] to String is a bad idea and it is the root cause. The only thing that is restricting me is that i cannot change the
method signature because it will lead to a huge code change but since there seems to be no other option, i will try to use byte[] and avoid String data types.

Regards.
7 years ago

John Jai wrote:

Praveen wrote:I have done the changes you suggested( by specifying UTF-8 in toString() and getBytes() ) but still getting the same exception.


Praveen,
It would be better if you post your modified code, so that if Paul comes back he can verify if you have done the changes in a right way.



I have edited the code in my first post as per Paul's suggestions. I do not think that will make much difference as the default encoding is "UTF-8".
7 years ago
Hi John,

Thank you for the reply. i can write bytes as you have mentioned but while reading how can i read name and value parts separately as the read() method
takes byte[] as an argument and we need to specify its size.

Regarding encoding. I have explicitly set to UTF-8 so i have no problems with that. For Cp1252 encoding type this code works properly.
7 years ago
Hello Paul,

Thank you for the reply. First of all i forgot to mention that i am running this with default encoding as UTF-8 so system default will be UTF-8.
Let me tell you my usecase. I receive a huge number of strings as a string array which will be stored as bytes in a BLOB
field of database. Since i cannot change the method signature i need to send the result only as a String. This is what the packString does.
The string is converted to bytes and will be stored in DB in a different module which i cannot access.
The unpackString method does the viceversa i.e takes a String and returns String[]. For simplycity sake, i have ommitted converting to string[]
and just printed out the results.
One more thing to note is that this code works fine for less than 127 chars.
Regarding the closing of streams. I just ommitted it while reproducing this issue, although having it did not made any difference.
I have done the changes you suggested( by specifying UTF-8 in toString() and getBytes() ) but still getting the same exception.
I wonder why string return type works correctly for less than 127 chars.

Thank you.
7 years ago
Hello,

I am having trouble running the below program with strings more than 127 characters.
I am getting the following exception when the strings are more than 127 chars :

java.io.UTFDataFormatException: malformed input around byte 0
at java.io.DataInputStream.readUTF(DataInputStream.java:639)
at java.io.DataInputStream.readUTF(DataInputStream.java:547)
at com.TestMalformedInput.unpackString(TestMalformedInput.java:61)
at com.TestMalformedInput.main(TestMalformedInput.java:20)
An exception during unpacking

After analyzing the code found that the issue is because of conversion from bytes to string and vice versa.
I can run this program successfully when i convert the string arguments to byte[]. See the uncommented lines.
The biggest problem here is that i receive the variable in as string data type and i cannot change the method signature.
Could someone guide me on how to solve this issue.
Thank you in advance.

7 years ago
Hi Friends,

I am new to maven. I am trying to change my existing project(using ant previously) to maven. I facing a problem adding my existing jars to the project. I have learnt from the internet that to do this, i have 2 options

1. Intalling the dependencies from the repository.
2. Add to the local repository (file by file) using
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

I dont want to install a huge number of files from the repository, so tried
second option but its really hard for me to install each jar file one by one. Is there any better option or something to automate this task ? Please help.

Thanks in advance,
P R A V E E N
11 years ago
Really funny indeed.
[ March 17, 2008: Message edited by: Praveen Babu ]
The Basic Profile says:

R2003 A DESCRIPTION MUST use the XML Schema "import" statement only within the xsd:schema element of the types section.

R2004 A DESCRIPTION MUST NOT use the XML Schema "import" statement to import a Schema from any document whose root element is not "schema" from the namespace "http://www.w3.org/2001/XMLSchema".

I am not sure why RMH has said it the other way.
I dont think spring has this. MultiActionController doesnt support forms.
Follow the below link for a custom solution.
http://forum.springframework.org/showthread.php?t=11702
404 Error occurs when you have problems with your file path. Anyway, the following works fine for me.

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">myController</prop>
<prop key="/second.htm">myController</prop>
</props>
</property>
</bean>


<bean id="myController" class="pkg.SimpleController">
<property name="methodNameResolver" ref="controllerResolver"/>
</bean>

<bean id="controllerResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<props>
<prop key="/hello.htm">handleHello</prop>
<prop key="/second.htm">handleSecond</prop>
</props>
</property>
</bean>

Regards,
P R A V E E N
Hi Friends,

I am trying to implement an EJB SEI. I am using JBoss. I am able to access the wsdl from browser but was unable to get it from the client which is in the war file.I am getting the following message in console:

17:20:21,094 WARN [JSR109ServerMetaDataBuilder] Cannot obtain SEI mapping for:
pkg.Hello

Following are my configuration file snippets :

-- webservices.xml --

<webservice-description>
<webservice-description-name>HelloEJBWS</webservice-description-name>
<wsdl-file>META-INF/wsdl/MyEJBWS.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/MyEJBWS_mapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>HelloPort</port-component-name>
<wsdl-port xmlns fx="urn:Foo">pfx:HelloPort</wsdl-port>
<service-endpoint-interface>pkg.Hello</service-endpoint-interface>
<service-impl-bean>
<ejb-link>HelloEJBWS</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>

-- ejb-jar.xml --

<enterprise-beans>
<session id="Session_1">
<description>Stateless Session EJB SEI</description>
<display-name>Stateless Session EJB SEI</display-name>
<ejb-name>HelloEJBWS</ejb-name>
<service-endpoint>pkg.Hello</service-endpoint>
<ejb-class>pkg.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>

-- MyEJBWS_mapping.xml --

<package-mapping>
<package-type>pkg</package-type>
<namespaceURI>urn:Foo</namespaceURI>
</package-mapping>

Am i missing something ?

Thanks in advance,
Regards,
P R A V E E N
[ January 08, 2008: Message edited by: Praveen Babu ]
11 years ago
Hi,

You need to extend from org.springframework.web.servlet.mvc.multiaction.MultiActionController in order to aggregate multiple actions in a single class.

Regards,
P R A V E E N
Congrats Shikha!!! Thats a great score. And thanks for the info.
11 years ago

Originally posted by Arti Mahajan:
I am struggling to understand what its use is in UDDI?



Arti,

The tModel basically means a "Technical Model". Its actually a classification/categorization type. Think of a situation where in you want to classify your webservices based on a specific type say a Manufacturing Company or a Shipping Company. There are some international standards that allows us to distinguish between these two types by giving them a unique id( UNSPSC id, for instance ). The tModel for a Manufacturing company will refer to a data structure which represents a Manufacturing Company based on the id given by the standard organization.

To put it simple, tModel is basically useful to categorize or classify the webservices in the UDDI registry.

Regards,
P R A V E E N
[ December 28, 2007: Message edited by: Praveen Babu ]

Originally posted by Alex Adam:
Hello.

If I set the JAXRPC_HOME to the jwsdp2.0 directory I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/rpc/tools/wscompile/Main



I think you are setting to JWSDP_HOME instead of setting to JAXRPC_HOME. There should be a directory named 'jaxrpc' under your home directory (C:\jwsdp2.0\jaxrpc, for example). set your JAXRPC_HOME to it and try.I suggest you use the samples given in the same directory and its build file
instead of manually typing the commands. Working with JAX-RPC is not as simple as using Axis. Axis is a much simpler API to use(IMO).

Regards,
P R A V E E N
[ November 28, 2007: Message edited by: Praveen Babu ]