Hi I am new to Web services and Jaxb. struggling to get it work please help me.
we have a web service which was generated from wsdl and xsds using JDeveloper, here all Jaxb classes generated to one package which has package-info.java class with some namespace. by using generated Jaxb classes(some of them are ErrorType.java and WarningType.java) we have written some utility classes and its working fine.
now we got new wsdl&xsds to create one more new service for other requirement. when we generate jaxbs for this wsdl all classes created into other package with different namespace in the package-info.java class. but for this service also we have some common classes like ErrorType and WarningType by using them we have already a utility class.
to use that utility for this serivice i had to separate all the common classes into one package. but the problem is, since both the services has its own namespace, in common package-info.java class i can keep any one of the service's namespace only.
can you please help me is there any possibility to share these common classes across multiple web services.
You can create an external binding customization which matches the schema/namespace of the shared classes and puts them into a separate package.
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.1">
<bindings scd="x-schema::tns" xmlns:tns="http://common.schema.ns/">
<schemaBindings>
<package name="org.acme.foo.common" />
</schemaBindings>
</bindings>
</bindings>
Configure the generation to create an episode from this and include the episode in the builds for the different web services.
Check the following link:
https://metro.java.net/2.0/guide/Compiling_multiple_WSDLs_that_share_a_common_schema.html
Related
We are mantaining a java project that consumes a lot of different web services. Service definitions change regularly and new services are added very often. So we need to automate the generation of all the java clients.
We have a batch script that downloads(curl) all the needed wsdls and all the dependent schemas, then generates all the corresponding java clients(wsimport) and finally generates a jar that includes all the clients and all the wsdls and xsds which. We deploy this jar in our artifactory and we use it in our project. We need to include the wsdls and xsds in our jar to avoid jax-ws calls to the wsdls in execution.
The script has become a monster, because we use very different web services. Every wsdl, has it's own different schemas located in different urls, so we have to identify all the files that have to be downloaded and put the xsds in the correct path in the disk.
Our goal would be to have a script that, given a wsdl url list, downloads all the wsdls and dependent xsds in a folder so that we can execute wsimport against them.
SoapUI's "export definition" tool, exports the wsdld and the dependent schemas in a folder, and modifying the "ws:import" paths in the wsdl automaticaly. Is there any way to invoke this tool from command line?
Is there any other tool that would help us improving this process?
thanks in advance
I'm converting a XML from one XSD to another by using BizTalk maps. I have "schemalocation" import in one XSD just like below
<xs:import schemaLocation=".\CurrencySchema.xsd" namespace="http://Biztalk.CurrencySchema" />
I built this solution which includes two schemas and one BizTalk map. After I GACed it, İ have added the DLL to BizTalk assembly. There is no problem on this side.
The problem is beginning when I sent the XML to BizTalk for converting. While validation of this XML BizTalk gets error just like below.
System.Xml.Schema.XmlSchemaValidationException: Type 'http://Biztalk.CurrencySchema:curType' is not declared.
I checked the BizTalk schemas and maps from BizTalk application. Two schemas and one map uploaded correctly to BizTalk administration console.
I think BizTalk doesn't import the referenced XSD on validation process. I don't understand why.
Can someone tell me what is wrong?
I am trying to get Jersey to use EclipseLink as its context factory, however, the file jaxb.properties is not being read. The docs say the file needs to be in the folder with the domain classes being mapped and I have verified that. I'm certain it is not being read because I have fubar'd the class name
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactoryXXX
No need to use jaxb.properties. Add a dependency to "jersey-media-moxy" using Maven. Jersey will automatically pick up MoxyXmlFeature (contained in the JAR) and then configure and use MoxyContextResolver to build new JAXB instances.
You may need to add an exclusion to the jersey-media-moxy dependency to avoid pulling in an unwanted version of the org.eclipse.persistence.moxy artifact.
My scenario is this:
I have a template with some base code for my application. This template has some custom renderers and some beans in the faces-config.xml file.
Then I have my application that inherits the base code from the template and this application has some additional beans. And everytime I refresh from the template I need to manually add the "local" application beans into faces-config.xml.
Is there a way to have multiple faces-config.xml files or is there another way to fix this problem?
This sounds like a perfect use case for an OSGi plugin: shared features applied to an application that, in turn, has its own custom behavior. An XSP Library supports multiple faces-config files because there's an explicit method for declaring which files to load. An NSF, on the other hand, assumes it contributes only one of its own.
I am using the xjc ant task provided by the JAXB-RI to generate our jaxb classes and provide all the jaxb jars in with my web application's WEB-INF/lib folder. Jersey is still using the runtime provided jaxb implementation (found in rt.jar) Is there some way to use #Provider to force it to use the jaxb-ri jars?
As far as I understood the problem correctly, this small tutorial should help.