XSD import from file - wso2-esb

We are in the process of putting a wso2esb server in between our webservices and our customers. I'am having problems with imports and includes in the wsdl-files.
To make the migration simple, we thought we'd copy all the wsdl and xsd files we've got on to a directory on the esb server (but outside of the wso2esb software). In creating the services in the esb, I now refer to the wsdl-files using 'specify source WSDL'.
This does show a wsdl, but not (exactly) the one we've created. So we're using 'useOriginalwsdl=true', 'modifyUserWSDLPortAddress=true', 'showAbsoluteSchemaURL=true'.
In one of our wsdl we'ver got this piece of code:
<xs:schema targetNamespace="http: //www.egem.nl/StUF/wsdl/zkn0201.wsdl">
<xs:import schemaLocation="xsd/stuf0204.xsd" namespace="http://www.egem.nl/StUF/StUF0204"/>
<xs:import schemaLocation="xsd/zkn0201.msg.xsd" namespace="http://www.egem.nl/StUF/sector/zkn/0201"/>
</xs:schema>
with the above parameters set, this shows in the wsdl of the service as:
<xs:schema targetNamespace="http://www.egem.nl/StUF/wsdl/zkn0201.wsdl">
<xs:import namespace="http://www.egem.nl/StUF/StUF0204" schemaLocation="HAEM_TEST?xsd=xsd/stuf0204.xsd"/>
<xs:import namespace="http://www.egem.nl/StUF/sector/zkn/0201" schemaLocation="HAEM_TEST?xsd=xsd/zkn0201.msg.xsd"/>
</xs:schema>
But when I query the wsdl with "http:// ...../sevices/HAEM_TEST?xsd=xsd/zkn0201.msg.xsd", it does not return the content of the xsd. Even though the xsd's are presenton disk relative to the actual wsdl used by the service:
On disk:
$ ls -lR /some/path/to/my/resource
.:
drwx------. 2 wnproesb01 wnproesb01 4096 Apr 17 23:15 xsd
-rwx------. 1 wnproesb01 wnproesb01 9498 Apr 16 18:31 zkn0201.wsdl
./xsd:
-rwx------. 1 wnproesb01 wnproesb01 13885 Apr 16 18:31 stuf0204.xsd
-rwx------. 1 wnproesb01 wnproesb01 63982 Apr 16 18:31 zkn0201.msg.xsd
These xsd-files may have imports or includes themselves, given by a relative path compared to themselves.
The big question: what do I need to do, to make this wsdl a valid, working wsdl as presented by the wso2esb? Including all the included/imported xsd's.

You can use Registry to store WSDLs and then refer from there. Which is far more convenient than storing in file system.
http://madhukaudantha.blogspot.nl/2012/07/wso2-esb-proxy-from-registry.html
and also refer this on how to define the schema location for WSDL imports correctly.
WSO2 ESB 4.5.0 fails to create proxy service from governance registry

Related

Delete a S3 file using WSO2 ESB S3 connector

I am running into issues while trying to delete a file that resides in Amazon S3 using the WSO2 ESB connector. Here is what I have done:
1) Created a proxy service in WSO2 ESB using the following taken from the WSO2 documentation :
2) I made sure that the proxy service is deployed to WSO2 then using POSTMAN
3) I submitted the following to POSTMAN:
<deleteObject>
<accessKeyId>MYACCESSKEY</accessKeyId>
<secretAccessKey>MYSECRETKEY</secretAccessKey>
<methodType>DELETE</methodType>
<contentType>application/xml</contentType>
<expect>100-continue</expect>
<region>us-east-1</region>
<host>s3.amazonaws.com</host>
<bucketUrl>http://s3.amazonaws.com/MYBUCKET</bucketUrl>
<bucketName>MYBUCKET</bucketName>
<isXAmzDate>true</isXAmzDate>
<objectName>FILETODELETE.txt</objectName>
<versionId></versionId>
</deleteObject>
I get the following error message (beginning of message):
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>MYACCESSKEY</AWSAccessKeyId>
<StringToSign>AWS4-HMAC-SHA256
Sat, 07 Jul 2018 15:25:18 GMT
20180707/us-east-1/s3/aws4_request
618b0c822492e3dd2a8f4d9e1ea</StringToSign> <SignatureProvided>06b2b268cb90b69a1c5dadbb689ed4ccf7b459ff1b5</SignatureProvided>
<StringToSignBytes>BUNCH OF NUMBERS</StringToSignBytes>
<CanonicalRequest>DELETE
/MYBUCKET/xxxxx.txt/
content-type:application/xml
host:s3.amazonaws.com
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:Sat, 07 Jul 2018 15:25:18 GMT
content-type;host;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD</CanonicalRequest>
<CanonicalRequestBytes>BUNCH OF NUMBERS</CanonicalRequestBytes>
<RequestId>SOODEDIBD</RequestId>
<HostId>vLllBSaWMHkV+gqX6yh7+43WK4PsAO4VVXLdGePBvGWZtxxExbBqI=</HostId>
I recreated my S3 credentials, but I am still running into the same error, any help will be greatly appreciated.
Frank
After going through delete object for S3, you need to check if the header values are going proper or not, as there is authentication required before accessing the web service , The header should look something like this .
DELETE /my-image.jpg?versionId=3HL4kqCxf3vjVBH40Nrjfkd HTTPS/1.1
Host: bucketName.s3.amazonaws.com
x-amz-mfa: 20899872 301749
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=
You can put wso2 esb on debug mode and confirm where proper header is being passed or not, else take a TCPDUMP to be accurate

AWS signature v4 authentication succeeds for EU bucket but fails for US bucket?

I recently implemented AWS Signature version 4 using the REST API. This is verified by an extensive regression test working perfectly.
The problem I'm experiencing is that the regression test succeeds when run against a bucket residing in the eu-central-1 region, but consistently fails with the Accessed Denied error message for buckets residing in us-east-1 or us-west-2.
Here are snippets from successful and failed attempts.
eu-central-1 : successful
HTTP request:
GET./
host:s3.eu-central-1.amazonaws.com.x-amz-content-sha256:e3b0...b855.x-amz-date:Wed, 25 May 2016 03:13:21 +0000
host;x-amz-content-sha256;x-amz-date.e3b0...b855
Signed string:
AWS4-HMAC-SHA256
Credential=AKIAJZN7UY6XHIZPWIKQ/20160525/eu-central-1/s3/aws4_request,
SignedHeaders=host;x-amz-content-sha256;x-amz-date,
Signature=cf5f...4dc8
Server response:
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult
xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>100a...a575</ID>
</Owner>
<Buckets>
<Bucket>
. . .
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
us-east-1 : failed
HTTP request:
GET./
host:s3.us-east-1.amazonaws.com.x-amz-content-sha256:e3b0...b855.x-amz-date:Wed, 25 May 2016 03:02:27 +0000
host;x-amz-content-sha256;x-amz-date.e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Signed string:
AWS4-HMAC-SHA256
Credential=AKIAJZN7UY6XHIZPWIKQ/20160525/us-east-1/s3/aws4_request,
SignedHeaders=host;x-amz-content-sha256;x-amz-date,
Signature=01e97...4d00
Server response:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>92EEF2A86ECA88EF</RequestId>
<HostId>i3wTU6OzBrlX89xR4KnnezBx1Tb2IGN2wtgPJMRtKLjHxF/B6VdCQqPz1279J7e5</HostId>
</Error>
us-west-2 : failed
HTTP request:
GET./
host:s3.us-west-2.amazonaws.com.x-amz-content-sha256:e3b0...b855.x-amz-date:Wed, 25 May 2016 07:04:47 +0000
host;x-amz-content-sha256;x-amz-date.e3b0...b855
Signed string:
AWS4-HMAC-SHA256
Credential=AKIAJZN7UY6XHIZPWIKQ/20160525/us-west-2/s3/aws4_request,
SignedHeaders=host;x-amz-content-sha256;x-amz-date,
Signature=cf70...36b9
Server response:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>DB143DBF0F316EB8</RequestId>
<HostId>5hWJ0AHM466QcT+BK4UaEFpqXFNaJFEuAPlN/ZZPBhL+NDYBoGaySRkXQ3BRdyfy9PBDuSb0oHA=</HostId>
</Error>
Attempts made to date include:
I found references (like here) where when using US Standard (i.e., us-east-1) the REST endpoint should not include "us-east-1". I have not yet found this written officially. I therefore created a us-west-2 bucket, in the hope that the REST endpoint needs to contain "us-west-2", but that also fails.
I searched on Google and StackOverflow for possible reasons for "Access Denied", which led me to adding a bucket policy that gives permissions to all -- to no avail.
The permissions of the EU and US accounts in the AWS console look the same, so no hint there, yet.
I added logging to the buckets in the hope of seeing a failure entry, but nothing is logged until authentication is completed.
Does anyone have an idea why AWS v4 authentication will consistently succeed for an eu-central-1 bucket, but equally fail for us-east-1 and us-east-2 buckets?
Here's your issue.
For unknown reasons,¹ eu-central-1 is an oddball in S3. The REST endpoint works with two variations in hostname: bucket.s3.eu-central-1.amazonaws.com or bucket.s3-eu-central-1.amazonaws.com.
The difference is the dot or dash after s3.
All other regions (as of now) except us-east-1 and ap-northeast-2 (which is just like eu-central-1) work only with the dash after s3, e.g. bucket.s3-us-west-2.amazonaws.com... not with a dot.
And us-east-1 expects either bucket.s3.amazonaws.com or bucket.s3-external-1.amazonaws.com.
And finally, any region will work with just bucket.s3.amazonaws.com within a few minutes after the original creation of a bucket, because the DNS is integrated with the bucket location database and automatically routes requests to the right place, for each bucket.
But note that when you sign the requests, you always use the actual region name in the signing algorithm itself -- not the endpoint -- as you appear to already be doing.
http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
¹I'll speculate that this convention is actually the "new normal" for new regions -- it's more consistent with other AWS services. S3 is one of the oldest, so it makes sense that legacy design decisions are more likely to exist, as seems to be the case, here.

Unable to generate WSDL 1.1 for this service

I have a wsdl (that works) and I've generated boilerplate code from it but wish to use my original wsdl not the auto generated one but on changing useOriginalwsdl to true I get errors. There is absolutely no documentation in the Axis website regarding this property so I have followed the steps here:
useOriginalwsdl=true is not working in axis2
specifically:
My services.xml has the same name as the wsdl service name
I have called my wsdl service.wsdl and put it in the META-INF folder (I also tried it with the service name)
But I get the error Unable to generate WSDL 1.1 for this service
Below is my folder structure:
.\com
.\lib
.\META-INF
services.xml
service.wsdl
My services.xml is:
<?xml version="1.0" encoding="UTF-8"?><!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST) -->
<serviceGroup>
<service name="MyService">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="com.neil.systems.ServiceMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">com.neil.webservice.MyService</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">false</parameter>
<operation name="Provision" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://xmlns.neil.com/systems">
<actionMapping>http://xmlns.neil.com/systems/Provision</actionMapping>
<outputActionMapping>http://xmlns.neil.com/systems/ProvisionResponse</outputActionMapping>
</operation>
</service>
</serviceGroup>
My service.wsdl, the relevant part is:
<wsdl:service name="MyService">
Note, I changed a couple of things in the services.xml to reduce the size so any obvious errors is just down to my cutting.

weblogic, deployments are not reading properties from WEB-INF/classes, configured using Spring

I have a similar problem to: Using external properties files in weblogic and note that the accepted answer there is mainly working for me.
However, I have a follow-up (sorry, cannot work out how to just add comments to re-open the original question)
Does anyone know what the actual cause of this is and the "correct" (if there is such a thing) solution, or do people take copying files to the domain as a common practise in weblogic (10.3.3)
What I am using is:
Spring config has this:
<bean id="messages" class="java.util.ResourceBundle" factory-method="getBundle">
<constructor-arg index="0" value="config/messages"/>
</bean>
the messages bean is then referenced in other beans
The error is
<code>
<11-Apr-2011 11:47:23 o'clock BST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1302518829904' for task '4'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1514)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
Truncated. see log file for complete stacktrace
Caused By: java.util.MissingResourceException: Can't find bundle for base name config/messages, locale en_GB
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:715)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
</code>
I have tried removing the config/ at the start (and copying the messages.properties to WEB-INF and also WEB-INF/classes, to no avail. Should also point out that all of messages, messages _en_GB and messages _en_US exist
Your path reference doesn't have a 'classpath' in it. Have you tried putting the config directory in the root of the war?

WCF-The document was understood, but it could not be processed

I have a WCF service which i deployed on my test server. Trying to use it on my test project and I added a reference and I get this error
The document was understood, but it could not be processed.
- The WSDL document contains links that could not be resolved.
- There was an error downloading 'http://localhost:8731/somewhere.nowhere.com/service1/?xsd=xsd2'.
- Unable to connect to remote server
- No connection could be made because the target machine actively refused it
Metadata contains a reference that cannot be resolved: 'http://192.1.1.1/TestService/somewhere.nowhere.com.svc?wsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported by service . The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.
I had my test app working before I added wsdlextras to my service project to include wsdl documentation.
This is the schema from my wsdl:
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd2" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd1" namespace="http://schemas.datacontract.org/2004/07/TestService"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd0" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>
Attempt to Fix 1:
I changed my
<host>
<baseAddresses>
<add baseAddress />
</baseAddresses>
</host>
so my addresses in my schema all mmatch up. I can update my service reference on my test project, however I cannot view any of my methods exposed by my wcf service.
My service is deployed on windows 2003 and my test app is on XP as well
Answer is here:
WCF IIS server configuration
in short...
The problem was with WCF identity permissions. The identity that is used for the application pool that hosts the WCF service must have full NTFS permissions on the %WINDIR%\temp folder. After changing that permission to my identity (LOCAL SERVICE) on C:\Windows\Temp I was able to add service reference to WCF service.
From the error message it looks as if it cannot find the imported xsd file xsd2.
The call to the service looks like it is on port 80, but the include files are referenced from point 8731.