Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soap 1.2 support on akka-camel-cxf-weather #1

Open
xray1111 opened this issue Jul 31, 2016 · 5 comments
Open

soap 1.2 support on akka-camel-cxf-weather #1

xray1111 opened this issue Jul 31, 2016 · 5 comments

Comments

@xray1111
Copy link

I wonder how to switch to soap 1.2 binding: changing the uri in MyProducerActor? or modify params in the test unit? I just have no clue on where can I put this soap version related information in the code or in the wsdl file.

@JSantosP
Copy link
Owner

Maybe you probable have to generate a new WSDL that allows binding to SOAP 1.2.
I'm not an expert on soap stuff, but I would try to generate a new WSDL using this tool, and then generate again the Java classes with wsdl2java.

@xray1111
Copy link
Author

Hi, Javier

I tried to regenerate the java code after using wsdl2soap, but it still
didn't work.

But I found some round ways to make it, I append a bindingId property to
the uri value, such as:

val uri = "cxf:http://192.168.0.104:8888/?" +
"serviceClass=org.onvif.devicemgmt.Device&bindingId=
http://www.w3.org/2003/05/soap/bindings/HTTP/"

And it works!

ren xiao

2016-07-31 19:41 GMT+08:00 Javier Santos [email protected]:

Maybe you probable have to generate a new WSDL that allows binding to SOAP
1.2.
I'm not an expert on soap stuff, but I would try to generate a new WSDL
using this tool http://cxf.apache.org/docs/soap-12.html, and then
generate again the Java classes with wsdl2java.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMx26KgmQ-LAxq68yf-xKYEXzd9Uq90hks5qbIoGgaJpZM4JY9tL
.

@JSantosP
Copy link
Owner

Glad to hear so! If I you need help with anything, please feel free to ask :-)

Regards,

Javier

@xray1111
Copy link
Author

xray1111 commented Aug 1, 2016

Hi, Javier

I encountered another problem, also related with soap, maybe you can help :)

in the java interface file generated from onvif org wsdl, there are some
methods which return "void", such as:

@WebMethod(operationName = "GetDeviceInformation", action = "

http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation")
@RequestWrapper(localName = "GetDeviceInformation", targetNamespace = "
http://www.onvif.org/ver10/device/wsdl", className =
"org.onvif.devicemgmt.GetDeviceInformation")
@ResponseWrapper(localName = "GetDeviceInformationResponse",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl", className =
"org.onvif.devicemgmt.GetDeviceInformationResponse")
public void getDeviceInformation(
@WebParam(mode = WebParam.Mode.OUT, name = "Manufacturer",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> manufacturer,
@WebParam(mode = WebParam.Mode.OUT, name = "Model", targetNamespace
= "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> model,
@WebParam(mode = WebParam.Mode.OUT, name = "FirmwareVersion",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> firmwareVersion,
@WebParam(mode = WebParam.Mode.OUT, name = "SerialNumber",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> serialNumber,
@WebParam(mode = WebParam.Mode.OUT, name = "HardwareId",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> hardwareId
);

you can see that it only has @ResponseWrapper annotation but
without @webresult, and the actual output parameters are annotated by
@WebParam. Because of this, when I
call camel.template.requestBodyAndHeaders(uri, body, headers) in program,
exceptions would be thrown as below. Should I call another api but of this
"requestBodyAndHeaders"?

[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 210 type
converters
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.17.2
(CamelContext: MyActorSystem) is starting
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - StreamCaching is enabled on
CamelContext: MyActorSystem
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.management.DefaultManagementStrategy - JMX is disabled
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - AllowUseOriginalMessage is
enabled. If access to the original message is not needed, then its
recommended to turn this option off as it may improve performance.
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultStreamCachingStrategy - StreamCaching in use
with spool directory:
C:\Users\XRay\AppData\Local\Temp\camel\camel-tmp-1549f71d-a3c5-49dd-bd01-e2d10f1cb0db
and rules: [Spool > 128K body size]
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Total 0 routes, of which 0 are
started.
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.17.2
(CamelContext: MyActorSystem) started in 1 minute
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean - Creating
Service {http://www.onvif.org/ver10/device/wsdl}DeviceService from class
org.onvif.devicemgmt.Device
[default-workqueue-1] WARN org.apache.cxf.phase.PhaseInterceptorChain -
Interceptor for {
http://www.onvif.org/ver10/device/wsdl}DeviceService#{http://www.onvif.org/ver10/device/wsdl}GetDeviceInformation
has thrown exception, unwinding now
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1168)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Thread.java:745)
[MyActorSystem-akka.actor.default-dispatcher-2] ERROR
akka.actor.OneForOneStrategy - Exception occurred during execution on the
exchange: Exchange[ID-XRay-PC-50851-1470028286205-0-2]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[ID-XRay-PC-50851-1470028286205-0-2]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1706)
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:660)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:264)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:313)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:309)
at
weatherws.MyProducerActor$$anonfun$receive$1.applyOrElse(MyProducerActor.scala:34)
at akka.actor.Actor$class.aroundReceive(Actor.scala:484)
at weatherws.MyProducerActor.aroundReceive(MyProducerActor.scala:18)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1168)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Thread.java:745)

2016-07-31 23:21 GMT+08:00 Javier Santos [email protected]:

Glad to hear so! If I you need help with anything, please feel free to ask
:-)

Regards,

Javier


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMx26OjUBmYdFiHDNBPoThRi_RuWNVVnks5qbL2MgaJpZM4JY9tL
.

@xray1111
Copy link
Author

xray1111 commented Aug 1, 2016

btw, I also used wireshark and observed that the soap server got the
request and gave an correct answer. So it seems that the client didn't
parse the result successfully cause the problem

thanks in advance!

2016-08-01 13:41 GMT+08:00 ren xiao [email protected]:

Hi, Javier

I encountered another problem, also related with soap, maybe you can help
:)

in the java interface file generated from onvif org wsdl, there are some
methods which return "void", such as:

@WebMethod(operationName = "GetDeviceInformation", action = "

http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation")
@RequestWrapper(localName = "GetDeviceInformation", targetNamespace = "
http://www.onvif.org/ver10/device/wsdl", className =
"org.onvif.devicemgmt.GetDeviceInformation")
@ResponseWrapper(localName = "GetDeviceInformationResponse",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl", className =
"org.onvif.devicemgmt.GetDeviceInformationResponse")
public void getDeviceInformation(
@WebParam(mode = WebParam.Mode.OUT, name = "Manufacturer",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> manufacturer,
@WebParam(mode = WebParam.Mode.OUT, name = "Model",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> model,
@WebParam(mode = WebParam.Mode.OUT, name = "FirmwareVersion",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> firmwareVersion,
@WebParam(mode = WebParam.Mode.OUT, name = "SerialNumber",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> serialNumber,
@WebParam(mode = WebParam.Mode.OUT, name = "HardwareId",
targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
javax.xml.ws.Holder<java.lang.String> hardwareId
);

you can see that it only has @ResponseWrapper annotation but
without @webresult, and the actual output parameters are annotated by
@WebParam. Because of this, when I
call camel.template.requestBodyAndHeaders(uri, body, headers) in program,
exceptions would be thrown as below. Should I call another api but of this
"requestBodyAndHeaders"?

[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 210 type
converters
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.17.2
(CamelContext: MyActorSystem) is starting
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - StreamCaching is enabled on
CamelContext: MyActorSystem
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.management.DefaultManagementStrategy - JMX is disabled
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - AllowUseOriginalMessage is
enabled. If access to the original message is not needed, then its
recommended to turn this option off as it may improve performance.
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultStreamCachingStrategy - StreamCaching in use
with spool directory:
C:\Users\XRay\AppData\Local\Temp\camel\camel-tmp-1549f71d-a3c5-49dd-bd01-e2d10f1cb0db
and rules: [Spool > 128K body size]
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Total 0 routes, of which 0 are
started.
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.17.2
(CamelContext: MyActorSystem) started in 1 minute
[MyActorSystem-akka.actor.default-dispatcher-2] INFO
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean - Creating
Service {http://www.onvif.org/ver10/device/wsdl}DeviceService from class
org.onvif.devicemgmt.Device
[default-workqueue-1] WARN org.apache.cxf.phase.PhaseInterceptorChain -
Interceptor for {
http://www.onvif.org/ver10/device/wsdl}DeviceService#{http://www.onvif.org/ver10/device/wsdl}GetDeviceInformation
has thrown exception, unwinding now
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1168)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Thread.java:745)
[MyActorSystem-akka.actor.default-dispatcher-2] ERROR
akka.actor.OneForOneStrategy - Exception occurred during execution on the
exchange: Exchange[ID-XRay-PC-50851-1470028286205-0-2]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[ID-XRay-PC-50851-1470028286205-0-2]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1706)
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:660)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:264)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:313)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:309)
at
weatherws.MyProducerActor$$anonfun$receive$1.applyOrElse(MyProducerActor.scala:34)
at akka.actor.Actor$class.aroundReceive(Actor.scala:484)
at weatherws.MyProducerActor.aroundReceive(MyProducerActor.scala:18)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1168)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Thread.java:745)

2016-07-31 23:21 GMT+08:00 Javier Santos [email protected]:

Glad to hear so! If I you need help with anything, please feel free to
ask :-)

Regards,

Javier


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMx26OjUBmYdFiHDNBPoThRi_RuWNVVnks5qbL2MgaJpZM4JY9tL
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants