Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions module-ballerina-wsdl/BalTool.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
id = "wsdl"

[[dependency]]
path = "../wsdl-cli/build/libs/wsdl-cli-1.0.3.jar"
path = "../wsdl-cli/build/libs/wsdl-cli-1.0.4-SNAPSHOT.jar"

[[dependency]]
path = "../wsdl-core/build/libs/wsdl-core-1.0.3.jar"
path = "../wsdl-core/build/libs/wsdl-core-1.0.4-SNAPSHOT.jar"

[[dependency]]
path = "lib/xsd-core-1.0.7.jar"
Expand Down
2 changes: 1 addition & 1 deletion module-ballerina-wsdl/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
distribution = "2201.11.0"
org = "ballerina"
name = "wsdltool"
version = "1.0.3"
version = "1.0.4"
authors = ["Ballerina"]
keywords = ["wsdl"]
repository = "https://github.com/ballerina-platform/wsdl-tools"
Expand Down
2 changes: 1 addition & 1 deletion module-ballerina-wsdl/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.11.0"
[[package]]
org = "ballerina"
name = "wsdltool"
version = "1.0.3"
version = "1.0.4"
modules = [
{org = "ballerina", packageName = "wsdltool", moduleName = "wsdltool"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public class WsdlToBallerina {
public static final String XMLDATA_NAMESPACE_URI = "@xmldata:Namespace {uri: \"%s\"}";
public static final String MISSING_HEADER_ELEMENT_ERROR = "Header element name cannot be extracted.";
public static final String MISSING_DATA_IN_HEADER_ERROR = "Header element is not found in the WSDL Definition: ";
public static final String MISSING_PART_IN_HEADER_ERROR =
"Processing Operation ''%s'' - Missing Part ''%s'' in Header ''%s''";
public static final String OPERATION_NOT_FOUND_ERROR = "WSDL operation is not found: ";
private Definition wsdlDefinition;
private ArrayList<SoapPort> soapPorts = new ArrayList<>();
Expand Down Expand Up @@ -232,11 +234,14 @@ public void generateFromWSDL(WsdlToBallerinaResponse response, Definition wsdlDe
DiagnosticUtils.getDiagnosticResponse(diagnosticMessages, response);
}

public static Header extractHeader(Definition wsdlDefinition, QName headerName, String elementName) {
public static Header extractHeader(Definition wsdlDefinition, QName headerName, String elementName,
String operationName) {
Objects.requireNonNull(headerName, MISSING_HEADER_ELEMENT_ERROR);
Message message = (Message) wsdlDefinition.getMessages().get(headerName);
Objects.requireNonNull(message, MISSING_DATA_IN_HEADER_ERROR + headerName);
Part partObj = (Part) message.getParts().get(elementName);
Objects.requireNonNull(partObj, String.format(MISSING_PART_IN_HEADER_ERROR, operationName, elementName,
headerName.getLocalPart()));
QName element = partObj.getElementName();
return new Header(element.getLocalPart(), element.getNamespaceURI());
}
Expand Down Expand Up @@ -284,7 +289,7 @@ private ModuleMemberDeclarationNode generateHeaderNode(WsdlOperation operation,
String localPart = operation.getInputHeaderName();
QName headerName = new QName(getWsdlDefinition().getTargetNamespace(), localPart);
for (String elementName : elementNames.keySet()) {
Header header = extractHeader(getWsdlDefinition(), headerName, elementName);
Header header = extractHeader(getWsdlDefinition(), headerName, elementName, operation.getOperationName());
headers.put(elementName, header);
}
StringBuilder stringBuilder = new StringBuilder();
Expand Down