Error in parsing Aramex WSDL file - java

When I'm trying to parse the Aramex shipping services WSDL (which is needed to create shipments), a namespace error occurs with following error log:
C:\Program Files\Java\jdk1.6.0_37\bin>wsimport.exe -keep -verbose D:\ATG\aramex\shipping-services-api-wsdl\shipping-services-api-wsdl.wsdl -d D:\ATG\aramex\java\
parsing WSDL...
[WARNING] src-resolve.4.2: Error resolving component 'ser:guid'. It was detected that 'ser:guid' is in namespace 'http://schemas.microsoft.com/2003/10/Serialization/', but components from this namespace are not referenceable from schema document 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'ser:guid'
needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'.
line 331 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 126 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
[ERROR] (Related to above error) This is the other declaration.
line 57 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
How can I get rid of the error?

OK i resolved it. I changed one declaration and after the it worked.

Related

java.lang.RuntimeException: Schema for namespace 'http://ws.abc.com/' already contains type

I am getting error while creating SOAP request.
21 May 2018 18:28:20,791 [Worker[3]] INFO [EndpointDescriptionImpl] [1111907bbb5ef75aNTQwZDM5Y2UxNTYxYzY1Mzc2MGJlM2ViOWUxYjNjMzA.] Building AxisService from wsdl: file: /tmp/unpacked_1526941165474/META-INF/wsdl/WS11_WSDL.wsdl 21 May 2018 18:28:20,792 [Worker[3]] ERROR [WSDL11ToAxisServiceBuilder] [1111907bbb5ef75aNTQwZDM5Y2UxNTYxYzY1Mzc2MGJlM2ViOWUxYjNjMzA.] Schema for namespace 'http://ws.abc.com/' already contains type 'doLoginResponse java.lang.RuntimeException: Schema for namespace 'http://ws.abc.com/' already contains type 'doLoginResponse
at org.apache.ws.commons.schema.XmlSchema.addType(XmlSchema.java:311)
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:158)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2186)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:306)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:297)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:265)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.buildAxisServiceFromWSDL(EndpointDescriptionImpl.java:789)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.setupAxisService(EndpointDescriptionImpl.java:651)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:216)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:181)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.updateEndpointDescription(ServiceDescriptionImpl.java:296)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.updateEndpoint(DescriptionFactoryImpl.java:268)
at org.apache.axis2.jaxws.description.DescriptionFactory.updateEndpoint(DescriptionFactory.java:96)
at org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:233)
at javax.xml.ws.Service.getPort(Service.java:92)
at com.alestra.ws.AddressWebService_Service.getAddressWebServicePort(AddressWebService_Service.java:51)
Can anyone suggest ?
Using java 1.6 and axis2 jars.
I also observered that in one system same code is working fine but in other code is getting this issue. I think this is not coding issue, may be some jar or other issue but not sure.

Internal Action was not loaded Error: java.lang.ClassNotFoundException

I am trying to run an implementation a jason code that is using some Internal Actions. The interpreter is showing that it was not possible to find the "java" code of the internal action, as showed:
Server running on http://191.36.8.42:3272
[aslparser] [peleus.asl:29] warning: The internal action class for 'org.soton.peleus.act.plan(Goals)' was not loaded! Error:
java.lang.ClassNotFoundException: org.soton.peleus.act.plan
[aslparser] [peleus.asl:42] warning: The internal action class for 'org.soton.peleus.act.isTrue(H)' was not loaded! Error:
java.lang.ClassNotFoundException: org.soton.peleus.act.isTrue
[peleus] Could not finish intention: intention 1: +des([on(b3,table),on(b2,b3),on(b1,b2)])[source(self)] <- ... org.soton.peleus.act.plan(Goals); !checkGoals(Goals); .print("Goals ",Goals," were satisfied") /
{Goals=[on(b3,table),on(b2,b3),on(b1,b2)]}Trigger: +des([on(b3,table),on(b2,b3),on(b1,b2)])[noenv,code(org.soton.peleus.act.plan([on(b3,table),on(b2,b3),on(b1,b2)])),code_line(29),code_src("peleus.asl"),error(action_failed),error_msg("no environment configured!"),source(self)]
[peleus] Adding belief clear(table)
This mas2j file is as following:
MAS peleus {
infrastructure: Centralised
agents:
peleus;
}
Part of agent code (written by Felipe Meneguzzi) is showed bellow:
//The next line is line 28
+des(Goals) : true
<- org.soton.peleus.act.plan(Goals);
!checkGoals(Goals);
.print("Goals ",Goals," were satisfied").
+!checkGoals([]) : true <- true.
//The next line is line 40
+!checkGoals([H|T]) : true
<- .print("Checking ", H);
org.soton.peleus.act.isTrue(H);
!checkGoals(T).
I guess it is about the folder structure, how to set up Jason to search for java files in specific locations?
The folders structure is like this:
Peleus\src\org\soton\peleus for java files
Peleus\examples for mas2j and asl tested project
It all depends on how you are executing the application.
If you are using java, the CLASSPATH should be defined to include the missing classes.
if you are using jason script (that uses Ant), the .mas2j file should include the class path as well.
More on that in the FAQ. Notice that CLASSPATH is where .class files are found, not .java source code files. The error regards a missing class, not a missing source code.

how to use Base64.getEncoder().encodeToString() and Base64.encodeBase64String() together in single file

I have a jsp file, in which I need to use to methods of class Base64.
one method is present in java.util :
java.util.Base64.getEncoder().encodeToString().
and another method is present in
org.apache.commons.codec.binary package :
org.apache.commons.codec.binary.Base64.encodeBase64String()
so to achieve this I used fully classified names but still it is givng error.
org.apache.jasper.JasperException: Unable to compile class for JSP: An
error occurred at line: 59 in the jsp file: /ProcessDetails.jsp
org.apache.commons.codec.binary.Base64 cannot be resolved to a type
56: String signature =
java.util.Base64.getEncoder().encodeToString(sha256_HMAC.doF‌​inal(data.getBytes()‌​));
59: String paymentToken =
org.apache.commons.codec.binary.Base64.encodeBase64String(sh‌​a256_HMAC.doFinal(da‌​ta.getBytes()));
Sounds like you might be missing either the apache commons jar in your WEB-INF/lib
see jsp "unable to compile" and "cannot be resolved to a type"
or perhaps a missing import statement in your JSP
see Unable to compile class for JSP: cannot be resolved to a type
Hope that helps

wsgen and App Engine

I'm trying to execute the wsgen command to create a Web Service. My command lines are:
PATH=%path%;C:\Program Files\Java\jdk1.6.0_24\bin
wsgen -cp ".\war\WEB-INF\classes" -wsdl -keep -r ".\war" -d ".\war\WEB-INF\classes" - s ".\war" "com.example.prototipo21.Greeting"
And this error appears:
warning: Cannot find annotation method 'valueStrategy()' in type 'javax.jdo.annotations.Persisten': class file for javax.jdo.annotations.Persistent not found.
error: Could not find class file for com.example.prototipo21.Greeting
1 error
1 warning
error: compilation failed, errors should have been reported
I think the problem could be I'm integrating a Datastore Application in a Web Service application so my class has different annotations. For example:
#WebService
public class Greeting {
#PrimaryKey
#Persistent (valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
#Persistent
private User author;
...
#WebMethod
public Key getKey() {
return key;
}
#WebMethod
public User getAuthor(){
return author;
....
you know what I mean?? Any idea will be very useful!! Thanks!
Those are my commands and the entire trace:
c:\Users\...\Desktop\....\Eclipse\Prototipo_21>PATH=%pa
th%;C:\Program Files\Java\jdk1.7.0_03\bin
c:\Users\...\Desktop\....\Eclipse\Prototipo_21>wsgen -c
p ".\war\WEB-INF\classes" -wsdl -keep -r ".\war" -d ".\war\WEB-INF\classes" -s "
.\war" "com.example.prototipo21.Greeting"
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
.\war\WEB-INF\classes\com\example\prototipo21\Greeting.class: warning: Cannot fi
nd annotation method 'valueStrategy()' in type 'Persistent': class file for java
x.jdo.annotations.Persistent not found
warning: unknown enum constant IdGeneratorStrategy.IDENTITY
reason: class file for javax.jdo.annotations.IdGeneratorStrategy not found
error: Could not create declaration for annotation type javax.jdo.annotations.Pr
imaryKey
error: Could not create declaration for annotation type javax.jdo.annotations.Pe
rsistent
Problem encountered during annotation processing;
see stacktrace below for more information.
com.sun.tools.internal.ws.processor.modeler.ModelerException: modeler error: Cla
sses annotated with #javax.jws.WebService must have a public default constructor
. Class: com.example.prototipo21.Greeting
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.o
nError(WebServiceAP.java:229)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.isLegalImplementation(WebServiceVisitor.java:515)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.shouldProcessWebService(WebServiceVisitor.java:322)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.visitClassDeclaration(WebServiceVisitor.java:113)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Clas
sDeclarationImpl.java:113)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.b
uildModel(WebServiceAP.java:319)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.p
rocess(WebServiceAP.java:260)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.
process(AnnotationProcessors.java:84)
at com.sun.tools.apt.comp.Apt.main(Apt.java:480)
at com.sun.tools.apt.main.AptJavaCompiler.compile(AptJavaCompiler.java:2
70)
at com.sun.tools.apt.main.Main.compile(Main.java:1127)
at com.sun.tools.apt.main.Main.compile(Main.java:989)
at com.sun.tools.apt.Main.processing(Main.java:113)
at com.sun.tools.apt.Main.process(Main.java:103)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.ja
va:207)
at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:120)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:42)
error: compilation failed, errors should have been reported
The error has no issues with the code you have written. The issue is with the classpath. If you examine the error you can distinctly see:
Could not find class file for com.example.prototipo21.Greeting1
Fix your classpath so that the class is available to wsgen and you might get a step ahead and stumble in next set of errors :) Good luck
I was having the same error. The reason why you are getting this error is that you have to give wsgen a reference to the libraries that GAE are using as well.
Just modify the classpath to include the other jar files. Note that in Unix we use colon ":" to separate directories and in Windows we use semi-colon ";".
(Just change the directory path accordingly)
class=com.sample.MyWebService
clpth='./war/WEB-INF/classes:/Applications/eclipse_jee/plugins/com.google.appengine.eclipse.sdkbundle_1.7.0/appengine-java-sdk-1.7.0/lib/opt/user/datanucleus/v2/jdo-api-3.1-SNAPSHOT-20110926.jar:/Applications/eclipse_jee/plugins/com.google.appengine.eclipse.sdkbundle_1.7.0/appengine-java-sdk-1.7.0/lib/user/appengine-api-1.0-sdk-1.7.0.jar'
resourcedir='./war'
outsourcedir='./src'
outdir='./war/WEB-INF/classes'
wsgen -cp "$clpth" -wsdl -keep -r "$resourcedir" -d "$outdir" -s "$outsourcedir" $class

XML validation error message always display

I am a Java developer. I'm working with a legacy system which is using Strtus1.2.9. After I added some jar file to this system and started the Tomcat, some error message display in the console. It seems like some of old xml file can not pass the parse. The tracback is like the following:
ERROR - Digester.error(1463) | Parse Error at line 396 column 35: Element type "var-value" must be declared.
org.xml.sax.SAXParseException: Element type "var-value" must be declared.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1171)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.commons.digester.Digester.parse(Digester.java:1591)
at org.apache.commons.validator.ValidatorResources.<init>(ValidatorResources.java:159)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:237)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:162)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
It seems like some xml has DTD version compatible issue. Why this error never display before. I just add these new jar files:
antlr-runtime-3.1.3.jar
drools-api-5.1.0.jar
drools-compiler-5.1.0.jar
drools-core-5.1.0.jar
drools-decisiontables-5.1.0.jar
drools-templates-5.1.0.jar
flatworm-2.0.1.jar
freemarker.jar
jxl-2.6.10.jar
jxls-reader-0.9.6.jar
mvel2-2.0.16.jar
xml-apis.jar

Categories