Axis cameras wsdl - java

Trying to integrate with axis camera to manage events and actions as described here http://www.axis.com/files/manuals/vapix_event_action_51386_en_1307.pdf
While generating service from wsdl provided in docs have stub instead of service. After quick review of wsdl found out that no service definition provided. How to deal with it?

I've resolved it by adding service definition to wsdl file like this:
<wsdl:service name="EventClient">
<wsdl:port name="Event" binding="aev:EventBinding">
<soap:address location="http://YOUR_CAMERA_IP/vapix/services"/>
</wsdl:port>
</wsdl:service>
And the service was generated.

Related

How do I translate a WSDl generated for Java Webservice into a C# client?

I am in .NET environment and I am supposed to reference and consume a java WebService with a WSDL.
I am not a wsdl master and neither have I done extensive work in WCF but normally WCF has two kind of binding which are BasicHTTP and WSHTTP but it sounds like I am not able to find any details on this looking at the WSDL. instead I do see something like following:
<wsdl:port name="SFAPI12" binding="tns:SFAPISoap12Binding">
<wsdlsoap12:address location="https://api.successfactors.eu:443/sfapi/v1/soap12" />
</wsdl:port>
followed by
<wsdl:binding name="SFAPISoapBinding" type="tns:SFAPI"><wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
I have no idea how to consume it in my C# application. Any ideas?
Right click the ServiceReference folder in your C# project, click on 'Add new service reference'. Give the java wsdl and enter an alias name for this service. Once this is done, then you can start using this alias for making client calls to the service.
You can use tool svcutil.exe.
Run from command line:
svcutil *.wsdl
It generates ".cs" and ".config" files.
svcutil.exe usually placed in directory:
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
or similar.

How to make JAX-WS use https for soap:address / schemaLocation

I'm using Scala + JAX-WS to build a simple SOAP server, but have run into issues with the auto generated locations in the WSDL. The service is published like this:
val endpoint = Endpoint(new MySoapServer())
endpoint.publish("http://10.2.2.100")
Which creates the following elements in the WSDL
<service name="MyService">
<port name="MyPort" binding="tns:MyPortBinding">
<soap:address location="http://10.2.2.100"/>
</port>
</service>
and
<xsd:schema>
<xsd:import schemaLocation="http://10.2.2.100/?xsd=1"/>
</xsd:schema>
However, the server sits behind a proxy that only accepts https requests, so those urls are useless...
How can I modify both the schemaLocation and soap:address location elements, so that they read https://10.2.2.100?
I've tried using X-Forwarded-Proto, as suggested here, but still no luck...

WCF Authentication Service - How to generate client using Apache Axis?

I have an ASP.NET application hosting a few WCF services, using ASP.NET Membership for security. I've exposed the System.Web.ApplicationServices.AuthenticationService through an SVC file (AuthenticationService.svc) as shown below:
<%# ServiceHost Language="C#" Debug="true" Service="System.Web.ApplicationServices.AuthenticationService" %>
My WCF configuration for this service is as follows:
<service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AuthenticationServiceBehaviors">
<endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding"/>
</service>
...
<behavior name="AuthenticationServiceBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
</behavior>
...
<bindings>
<basicHttpBinding>
<binding allowCookies="true"></binding>
</basicHttpBinding>
</bindings>
I've enabled the authentication service in my web.config as shown below:
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL="false"/>
</webServices>
</scripting>
</system.web.extensions>
I created a .NET console application to test the service. Visual Studio generated a client, and the service worked as expected. My problem is that I need to use this service from a Java application, but when I try to generate a client in Eclipse using Apache Axis, I get the following error:
IWAB0399E Error in generating Java from WSDL: java.io.IOException: Emitter failure.
There is an undefined portType (AuthenticationService) in the WSDL document
http://localhost:17637/Services/AuthenticationService.svc?wsdl=wsdl0.
Hint: make sure <binding type=".."> is fully qualified.
I've tracked it down to Apache Axis needing different namespace and name in the ServiceContract and ServiceBehavior, thanks to this post. I've changed other WCF services as that post shows, and they work just fine. The problem is that System.Web.ApplicationServices.AuthenticationService looks like this (from http://msdn.microsoft.com/en-us/library/system.web.applicationservices.authenticationservice.aspx):
[ServiceBehaviorAttribute(Namespace = "http://asp.net/ApplicationServices/v200", InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
[AspNetCompatibilityRequirementsAttribute(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceContractAttribute(Namespace = "http://asp.net/ApplicationServices/v200")]
public class AuthenticationService
Notice the ServiceBehaviorAttribute namespace is the same as the ServiceContractAttribute namespace? I need them to be different so I can get Eclipse (Apache Axis) to generate a client. Any ideas?
I do not think is possible to change name of built-in service. You should be allowed for wrapping built-in service in other service or for writing custom service handle authentication.

Does Apache CXF support "output only" services? If so, how do you get wsdl2java to handle it?

While using Apache CXF, I'd like to define a port type like this:
<wsdl:portType name="CustomerNotificationPort">
<wsdl:operation name="changeNotification">
<wsdl:output message="tns:NotificationMessage"/>
</wsdl:operation>
</wsdl:portType>
But, when wsdl2java runs, I get the following error:
Invalid WSDL, Operation changeNotification in PortType {http://blah.com/Customer/CustomerService/v1}CustomerNotificationPort not request-response or one-way
I'm interpreting this to mean that Apache CXF (and/or wsdl2java) does not support "output only" or "notification" style services.
Is this correct, or am I missing something?
If it matters, my port type is actually bound to a JMS transport, not HTTP.

WSDL2Java won't create all the stubs

I'm using Apache axis2 and more specifically, the wsdl2java tool to generate the stubs for a web service and create a client, given the wsdl file.
When I try to generate stub classes for a paypal web service (its wsdl file is here) axis won't generate stubs for both the bindings included to the wsdl but just for the second one (PayPalAPIAASoapBinding)
Has anybody worked on this wsdl with apache's wsdl2java tool before?
I've been struggling with this, too.
Short answer:
Append -pn PayPalAPI to your Axis2 command.
Long answer:
Take a look at following lines of the PayPal WSDL:
<wsdl:service name="PayPalAPIInterfaceService">
<wsdl:port name="PayPalAPI" binding="ns:PayPalAPISoapBinding">
<wsdlsoap:address location="https://api.sandbox.paypal.com/2.0/"/>
</wsdl:port>
<wsdl:port name="PayPalAPIAA" binding="ns:PayPalAPIAASoapBinding">
<wsdlsoap:address location="https://api-aa.sandbox.paypal.com/2.0/"/>
</wsdl:port>
</wsdl:service>
Obviously, the WSDL specifies 1 service with 2 ports. Our problem is that Axis2 only creates the stub for the second port, "PayPalAPIAA" but not for the port "PayPalAPI".
Now, take a look at the Axis 2 command line option reference (http://ws.apache.org/axis2/tools/1_2/CodegenToolReference.html#cmdref), specifically, at the description of the option -pn:
"Specifies the port name to be code generated. If the port name is not specified, then the first port (of the selected service) will be picked."
Thus, specifying -pn PayPalAPI does the trick.
apon,
I used Eclipse and created a new Web Service Client project and pointed to the URL you mentioned. I think i was able to create both the stubs. Can you please try creating stubs from Eclipse IDE once?

Categories