Consume SOAP service in spring-boot - web-services

I need to consume soap webservice in spring boot application. I found something over the internet https://spring.io/guides/gs/consuming-web-service/ and I tried that which results in the below exception.
I followed the below procedure for generating the java classes out of WSDL.
Project -> New -> Web Service Client -> pasted the WSDL URL -> Finish
2019-04-11 16:06:39.481 WARN 10268 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [com/test/myapp/client/ProductsConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "SomeWebService?wsdl" doesnt contain ObjectFactory.class or jaxb.index
- with linked exception:
[javax.xml.bind.JAXBException: "SomeWebService?wsdl" doesnt contain
ObjectFactory.class or jaxb.index]
2019-04-11 16:06:39.493 INFO 10268 --- [ main]
o.apache.catalina.core.StandardService : Stopping service [Tomcat]

Related

wso2am 2.6.0: SSL exception when invoking API which uses custom class mediator

Installed wso2am 2.6.0.
Created and published API - Myapi. Myapi is visible in API store and it can be invoked from there (receives correct response).
Created my own custom class demo mediator (nothing fancy, just outputs some information) and uploaded it to <API-M_HOME>/repository/components/lib.
Created sequence xml with my own custom class and manually uploaded it for Myapi (in API publisher 'Enabled message Mediation', for 'In Flow').
Restarted server and it looks like registered my custom class mediator successfully.
But now then i try to invoke this API through API store it throws such exception:
[2019-03-23 21:04:00,858] ERROR - SourceHandler I/O error: Received fatal alert: certificate_unknown
javax.net.ssl.SSLException: Received fatal alert: certificate_unknown
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1666)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1634)
at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1800)
at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1083)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doUnwrap(SSLIOSession.java:245)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:280)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:410)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:119)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
at java.lang.Thread.run(Thread.java:748)
[2019-03-23 21:04:00,874] INFO - LogMediator IN_MESSAGE = json_validator
[2019-03-23 21:04:00,879] INFO - LogMediator STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Error occured in the mediation of the class mediator
Same issue happens when i selected another i.e. json_validator mediator (which is not my custom, so issue is not just in my custom mediator), but i.e. with debug_in_flow mediator everything works.
It seems that this issue appears when mediator uses some class mediator and then it throws this SSL exception.
Any ideas where certificate should be added? As I understand inner service tries to invoke custom java class without certificate and fails.
Exception is throwing, but it doesn't affect custom mediator flow.

Not able to invoke axis2 service from wso2 ESB proxy service

I am new to OSB.
-> I have a AXIS2 webservice application running on wso2 appserver. If we pass a name as a parameter it will return hello + Name.
-> I am trying to access this application from proxyservice in WSO2 ESB application.
The project name is SampleESBConfig and proxy service name: ESBtoAxis2PS1
Steps for Implementing proxy service:
The proxy service ha wsdl url : http://localhost:9763/services/Test1?wsdl ; Wsdl Type: SOURCE_URL
InFlow
Placed LogMediator
place SendMediator
Created address endpoint which points to : http://localhost:9763/services/Test1 [ Target URL, AXIS2 webservice application URL]
OutFlow
Placed LogMediator
place SendMediator
Fault Sequence
Placed the LogMediator
Created Composite application which includes the above proxyservice
Deployed this application on WSO2 ESB server which is running on localhost.
Note:
Both ESB & appserver running on localhost
When i am trying to test the application getting the below error.
[2015-06-18 16:27:55,212] ERROR - Axis2Sender Unexpected error during
sending message out org.apache.axis2.AxisFault: The system cannot
infer the transport information from the
/services/ESBtoAxis2PS1.ESBtoAxis2PS1HttpSoap11Endpoint URL.
How do I fix this?
Let assume that your are calling the echo proxy and you are creating a soap project by providing the wsdl of your proxy service.Then the request url for echo service will be
http://localhost:8280/services/echo.echoHttpSoap11Endpoint and when you are going to invoke it, you will get the above error.
As a solution for it you need to remove the part behind the "." operator. So you proxy calling url will be http://localhost:8280/services/echo
According to the error log I found that you are calling the proxy service /services/ESBtoAxis2PS1.ESBtoAxis2PS1HttpSoap11Endpoint . So you need to call the proxy like /services/ESBtoAxis2PS1 as I mentioned earlier.
Hope this may solve the issue.

error while executing SSIS package with web service task

Description: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: The Web Service threw an error during method execution. The error is: Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message: -- IIS 7.5 Detailed Error - 500.24 - Internal Server Error Server Error in Application "DEFAULT WEB SITE" Internet Information Services 7.5 Error Summary HTTP Error 500.24 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. Detailed Error Information
Change your application pool properties to:
.NET Framework Version
-- .NET Framework *version*
Pipeline Mode
-- Classic
change your web.config like this:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>

Gives error while trying to upload rule service in Business Rules Server, WSO2

I am trying to upload a .aar file in the management console of Business rules server, but while uploading i am getting this error: TID: [] [WSO2 BRS] [2013-02-19 18:41:29,556] ERROR {org.wso2.carbon.rulecep.service.RuleCEPDeployerService} - Can not build the service {org.wso2.carbon.rulecep.service.RuleCEPDeployerService}
java.util.MissingResourceException: Can't find resource for bundle org.apache.axis2.i18n.ProjectResourceBundle, key The operation is not valid: operation name missing
at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
at java.util.ResourceBundle.getString(ResourceBundle.java:334)
at org.apache.axis2.i18n.MessageBundle.getMessage(MessageBundle.java:194)
at org.apache.axis2.i18n.MessageBundle.getMessage(MessageBundle.java:83)
at org.apache.axis2.i18n.Messages.getMessage(Messages.java:74)
at org.apache.axis2.deployment.ServiceBuilder.processOperations(ServiceBuilder.java:717)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:355)
at org.wso2.carbon.rulecep.service.ServiceBuilder.createAxisService(ServiceBuilder.java:266)
at org.wso2.carbon.rulecep.service.ServiceBuilder.build(ServiceBuilder.java:146)
at org.wso2.carbon.rulecep.service.RuleCEPDeployerService.deploy(RuleCEPDeployerService.java:77)
at org.wso2.carbon.rule.service.RuleServiceDeployer.deploy(RuleServiceDeployer.java:69)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:371)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:365)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:73)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:94)
at org.apache.axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:93)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
TID: [] [WSO2 BRS] [2013-02-19 18:41:29,572] INFO {org.apache.axis2.deployment.DeploymentEngine} - org.apache.axis2.deployment.DeploymentException: Can't find resource for bundle org.apache.axis2.i18n.ProjectResourceBundle, key The operation is not valid: operation name missing {org.apache.axis2.deployment.DeploymentEngine}
TID: [] [WSO2 BRS] [2013-02-19 18:41:29,572] INFO {org.apache.axis2.deployment.DeploymentEngine} - org.apache.axis2.deployment.DeploymentException: Can't find resource for bundle org.apache.axis2.i18n.ProjectResourceBundle, key The operation is not valid: operation name missing {org.apache.axis2.deployment.DeploymentEngine}
try this method: http://wso2.com/library/articles/2013/05/eclipse-plugin-wso2-business-rules-server
I used to have problems similar to yours while uploading the .aar files through the wizard, but I followed the above tutorial and it works perfectly fine.

Handle WCF exceptions from webservice proxy

I have a WCF service (.NET 4) hosted in IIS. My service contract has one method with:
[FaultContract(typeof(string))]
My service implementation for that method validates input parameters and may throw an exception like this:
if (string.IsNullOrWhiteSpace(siteName)) { throw new FaultException("siteName is required."); }
The consumer program of this service is a .NET 2 console application. In this app I generated the webservice proxy by right clicking "References" and "Add web reference".
When I try to call the service method from the client app, by sending an invalid siteName, I get back a 503 Service Unavailable exception, instead of a FaultException with the custom error message.
How can I make the FaultException, with the custom error message, propagate to the client program?
UPDATE:
The exception I get in the client application is this:
System.ServiceModel.ServerTooBusyException:
The HTTP service located at
http://www.example.com/services/myservice.svc
is too busy. ---> System.Net.Web
Exception: The remote server returned
an error: (503) Server Unavailable.
at
System.Net.HttpWebRequest.GetResponse()
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
nnelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception
stack trace ---
The problem was being caused by a custom HTTP module in our web project. So it was not exactly a WCF problem, but a problem specific to our solution. Thanks!