Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Making scene7 soap call from spring boot!

Avatar

Level 1

Hi Team,


I have a requirement where in we need to make scene7 soap call from spring application to get the given image member set ( multiple images associated). Wdls file I have is :

http://s7ips1.scene7.com/scene7/webservice/IpsApi.wsdl

not sure if its latest wsdl reason being I am getting :

org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: class org.com.project1.cm.CreateRequest nor any of its super class is known to this context..)

I followed article : https://www.baeldung.com/spring-soap-web-service to make soap call from spring boot.

I am appreciate your help or any pointers or reference document is greatly appreciated!

4 Replies

Avatar

Employee Advisor

Hi @akashs71073883 ,

 

The error looks like the annontations are not being followed properly.

Are you adding any annotation on CreateRequest() method ?

Thanks,

Milind

Avatar

Level 1

Below is the code i am using to create request.

   public GetAssetsByNameReturn getAssetsByNameReturn(String[] items) {
GetAssetsByNameParam getAssetsByNameParamRequest = new GetAssetsByNameParam();
getAssetsByNameParamRequest.setCompanyHandle("xxxxxxxxxxx");
StringArray itemArray = new StringArray();
for (String item : items){
itemArray.getItems().add(item);
}
getAssetsByNameParamRequest.setNameArray(itemArray);


return (GetAssetsByNameReturn) getWebServiceTemplate().marshalSendAndReceive(
"https://s7sps1apissl.scene7.com/scene7/api/IpsApiService", getAssetsByNameParamRequest,
message -> {
try {
AuthHeader authHeader = getS7AuthHeader();
authHeader.setAccessToken(applicationConfig.getScene7AccessToken());
authHeader.setAppName(applicationConfig.getScene7AppName());
authHeader.setAppVersion(applicationConfig.getScene7AppVersion());
((SOAPMessage) message).set.setSoapAction("getAssetsByName");
SoapMessage soapMessage = (SoapMessage)message;
SoapHeader soapHeader = soapMessage.getSoapHeader();
this.getMarshaller().marshal(authHeader, soapHeader.getResult());


} catch (Exception e) {
log.error("Error during marshalling of the SOAP headers", e);
}
});
}



 

 

I am not using any annotation Milind. However, when I hardcode the request I get  <?xml version='1.0' encoding='UTF-8'?><tns:ipsApiFault xmlns:tns="http://www.scene7.com/IpsApi/xsd"><tns:code>30000</tns:code><tns:reason>Required authHeader element not found.</tns:reason></tns:ipsApiFault>"

 

Appreciate your response!

Avatar

Employee Advisor

Hi @akashs71073883 ,

 

Does the error say which line exactly has issue here.

I was going through certain threads :
https://stackoverflow.com/questions/14057932/javax-xml-bind-jaxbexception-class-nor-any-of-its-super...


I suppose the issue lies with Marshaller here, can you post the full log if possible, thanks.