This is my first time creating Asynchronous Web Service clients. I have my wsdl file but I'm confused where to put:
<enableAsyncMapping>true</enableAsyncMapping>
Based on research, this is how to add it:
<bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="AddNumbers.wsdl"
xmlns="http://java.sun.com/xml/ns/jaxws">
<bindings node="wsdl:definitions">
<package name="examples.webservices.async"/>
<enableAsyncMapping>true</enableAsyncMapping>
</bindings>
</bindings>
Should this be in a separate file or something? I read about the bindings file but still confused how to use it.
or can it be placed in the same WSDL file itself?
I am using the wsimport command to generate the client classes
I know it is old, but I needed it and google sent me here. It might help someone else in the future.
Using suggestions in one of the answers of this related question on wsimport, I created a custom xml file async.xml like this:
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableAsyncMapping>true</jaxws:enableAsyncMapping>
</jaxws:bindings>
And used wsdl2java with the following options (-b async.xml):
wsdl2java -client -d ClientDir -b async.xml myservice.wsdl
And I got the same (and more) version of the stubs returning Future<?>:
public Future<?> authorize
Cheers
Related
I am trying to speed up execution of code being debugged with JRebel. In particular, I notice that framework code is slow. I am wondering whether I can tell JRebel to ignore certain packages, in much the same way that we can setup JProfiler to ignore certain packages and patterns.
You most definitely can.
Use a system property (or add to jrebel.properties) meant just for that purpose. More information at JRebel agent properties.
-Drebel.exclude_packages=PACKAGE1,PACKAGE2,...
Specify the excluded packages in rebel.xml using Ant-styled patterns. More information at rebel.xml configuration.
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="/path/to/module/build/directory/root">
<exclude name="com/yourapp/package1/internal/**"/>
</dir>
</classpath>
</application>
Both ways work similarly but since the second one enables to customize each module inividually it is generally preferred.
as I am at my wits and I decided to post this also on StackOverflow.
I recently tried to create a basic Hello World web service (through the Function Builder), and turn it into a WSDL. Then using (Java) wsimport function turning it into java files.
The finction looks like this:
FUNCTION ZWEBSERVICE1.
write: / 'hello world'.
ENDFUNCTION.
The first problem I encountered is while executing wsimport. I got a error that states that wsdl:service is not in the file. After googling a while, I found no discussions/solutions to that problem. So I just wrote:
<wsdl:service name="ZWEBSERVICE1">
</wsdl:service>
into the file, and executed wsimport again, and got my java and class files.
The next problem I encountered is that the ZWEBSERVICE1.java class is somewhat empty... It looks like this:
...
public class ZWEBSERVICE1 {
}
... so now I am at my wits end, and hope that someone can give me some insight in what I did wrong.
I posted this as dicussion on SAP, so if there are any changes there I will update this topc.
http://scn.sap.com/thread/3800470
WRITE is used to produce ABAP lists for interactive display of offline usage within the ABAP system. It is not suitable for web services in any way. Since your function does not appear to have any parameters, it doesn't make much sense to turn it into a web service - I wouldn't expect anything but an empty WSDL file in this case...
I want to change the double quotes to single quotes for a single namespace declaration in my document, while leaving all other namespace declarations as double quotes. How can I do this?
Here's the response document from the server:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><InquiryResponse
xmlns="http://www.openuri.org/"><Header><HeaderAttr1>abcd</HeaderAttr1><HeaderAttr2>xxx</HeaderAttr2><HeaderAttr3>string</HeaderAttr3></Header><Body><InquiryResult><ResultItem1>theresulttext</ResultItem1><ResultItem2>abcd</ResultItem2><ResultItem3>0</ResultItem3></InquiryResult></Body></InquiryResponse></soapenv:Body></soapenv:Envelope>
I need something like (note that open:InquiryResponse has ' not ").
<?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body>
<open:InquiryResponse
xmlns:open='http://www.openuri.org/'><open:Header><open:HeaderAttr1>abcd</open:HeaderAttr1><open:HeaderAttr2>xxx</open:HeaderAttr2><open:HeaderAttr3>string</open:HeaderAttr3></open:Header><open:Body><open:InquiryResult><open:ResultItem1>theresulttext</open:ResultItem1><open:ResultItem2>abcd</open:ResultItem2><open:ResultItem3>0</open:ResultItem3></open:InquiryResult></open:Body></open:InquiryResponse>
</SOAP-ENV:Body> </SOAP-ENV:Envelope>
I have been able to do namespace prefix change, additional namespace declarations, whitespace fixups, character set change, all I need now is to change those two bytes.
I'm using Spring WS + Woodstox + Axiom to build a simple inquiry web service. It's a replacement for an existing service and I would like to make it byte-for-byte identical ($$ reasons). I can get the XML to identical type, but we don't know at this point which consumers use a grep or regex to find the data.
I am trying to attack this problem so far using an XSLT and PayloadTransformingInterceptor. I would be interested in other options as well.
Comments are pretty much correct: there is no "clean" programmatic solution to configuring low-levels with such precision. And given fragility, you are best off using textual mangling; most likely regexps would work well enough if this is for testing or such.
After re-reading your question and examples a few times I think I understand the problem :)
I think you should take a look at the PayloadTransformingInterceptor. You can transform the incoming and outgoing messages in that interceptor. A typical usage of that interceptor is to support an older version of your wsdl by transforming it to the new version. This interceptor can work both ways - in your case only outgoing.
I'm not sure if this can be fixed by using XSLT. If not, you can create your own Interceptor to provide the specific string replacement functionality you need.
The solution was to drop Spring-WS, and instead move to CXF. CXF allows interceptors at any stage of processing, and hence full access to the bytes of the message stream. Ugly, but working. Build an interceptor to hook the OutputStream at PRE_STREAM and then do the fix at PRE_STREAM_ENDING, and you will have full control over the SOAP Envelope.
Thank you all for your responses. It sucks but it works, and is reasonably easy to disconnect when we have the time to do it properly (!!).
I have a C++ application which has written for years. There are a lot of classes.
Every time we want to change some parameter values, we need to manually update them in the code and recompile it. It is not convenient as the growing demands of the users. We would like the values of the classes to be configured out side of the application. Probably, reading form an xml is the best? for each user, we can make an xml configuration setting and send it together with the application. Is it a good approach?
For every class e.g: Class classA, should we create another class called: ConfigClassA then classA will use the configuration setting from ConfigClassA? We dont want to make a lot of changes in the current implementation.
Suppose there is a structure of an xml file:
<classes>
<class name="ClassA">
<variable id="isUp" value="true" />
</class>
</classes>
In Xml, we can get the portion classA and parse it to ConfigClassA then classA has an instance of ConfigClass.
Or anybody has a better approach?
Thanks in advance.
In general I think that the whole configuration should be loaded when an application is launched, so you can immediately notify the user in case of an invalid configuration. In order to validate an XML file, you can use XML Schema.
However, if you don't want to make a lot of changes in the current implementation, your idea could be a valid solution.
Using JSON or YAML will be more lightweight than XML, since the parser of the config file will be simpler. Anyway, XML is also feasible.
It's actually quite common to have configuration files. The format in which they are stored is not important. They are usually loaded only once, at the beginning of the program, not queried each time a method requests something.
Also, you should make a tool available for editing these files (such as a "Preferences..." panel).
Our users are asking for a simple way to convert DocBook XML to OOXML (DocBook to Word DOCX) and back. The editing in house is done in Oxygen XML Editor but sometimes they have to send files for editing to other people and Word is still the de facto standard.
I imagine this will be a major undertaking so any help is appreciated.
EDIT:
Found docbook2wordml XSL stylesheets. This could be useful.
Try Oxgarage: http://www.tei-c.org/oxgarage/ it converts between DocBook and OOXML (and other formats) via TEI.
You can use it as a web service, or you can get the XSLT 2.0 scripts here: https://github.com/TEIC/Stylesheets/
Edit: updated links!
OxGarage http://oxgarage.oucs.ox.ac.uk:8080/ege-webclient/ seems down.
Alternatively, you can get up running your own OxGarage service using the OxGarage docker image, which should be the preferable way.
Also you could try building an OxGarage docker image yourself using this oxgarage-docker GutHub repo. Once it's up running, then you can use the OxGarage web client in your browser:
http://<your host name e.g., localhost>:8080/ege-webclient