Skip to content

Commit c271204

Browse files
committed
fix(soap): improves example generation logging.
1 parent 018fc79 commit c271204

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

mock/soap/src/main/java/io/gatehill/imposter/plugin/soap/SoapPluginImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class SoapPluginImpl @Inject constructor(
192192
"Only document and RPC style SOAP bindings are supported"
193193
}
194194

195-
LOGGER.debug("Matched operation: ${operation.name} in binding ${binding.name}")
195+
LOGGER.debug("Matched operation: ${operation.name} in binding: ${binding.name}")
196196
return@build handle(config, parser, service, binding, operation, httpExchange, bodyHolder, soapAction)
197197
}
198198
)

mock/soap/src/main/java/io/gatehill/imposter/plugin/soap/model/OperationMessage.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,27 @@ abstract class OperationMessage(
6060
class ElementOperationMessage(
6161
namespaces: List<Map<String, String>>,
6262
val elementName: QName,
63-
val elementType: QName,
6463
) : OperationMessage(
6564
namespaces = namespaces
66-
)
65+
) {
66+
override fun toString(): String =
67+
"ElementOperationMessage(elementName=$elementName)"
68+
}
6769

6870
/**
6971
* Message parts specifying an XML schema `type` are supported
7072
* in WSDL 1.1 but not in WSDL 2.0.
7173
*/
7274
class TypeOperationMessage(
7375
namespaces: List<Map<String, String>>,
74-
val operationName: String,
7576
val partName: String,
7677
val typeName: QName,
7778
): OperationMessage(
7879
namespaces = namespaces
79-
)
80+
) {
81+
override fun toString(): String =
82+
"TypeOperationMessage(partName='$partName', typeName=$typeName)"
83+
}
8084

8185
/**
8286
* In WSDL 1.1, messages can define multiple parts.
@@ -88,4 +92,7 @@ class CompositeOperationMessage(
8892
val parts: List<OperationMessage>
8993
): OperationMessage(
9094
namespaces = emptyList()
91-
)
95+
) {
96+
override fun toString(): String =
97+
"CompositeOperationMessage(parts=$parts)"
98+
}

mock/soap/src/main/java/io/gatehill/imposter/plugin/soap/parser/Wsdl1Parser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ class Wsdl1Parser(
242242
// directly as well as referring to elements.
243243
getAttributeValueAsQName(messagePart, "element")?.let { elementQName ->
244244
val ns = listOf(elementQName.toNamespaceMap())
245-
resolveElementTypeFromXsd(elementQName)?.let { ElementOperationMessage(ns, elementQName, it) }
245+
resolveElementTypeFromXsd(elementQName)?.let { ElementOperationMessage(ns, elementQName) }
246246

247247
} ?: getAttributeValueAsQName(messagePart, "type")?.let { typeQName ->
248248
val ns = listOf(typeQName.toNamespaceMap())
249-
resolveTypeFromXsd(typeQName)?.let { TypeOperationMessage(ns, operationName, partName, it) }
249+
resolveTypeFromXsd(typeQName)?.let { TypeOperationMessage(ns, partName, it) }
250250

251251
} ?: throw IllegalStateException(
252252
"Invalid 'element' or 'type' attribute for message: $messageName"

mock/soap/src/main/java/io/gatehill/imposter/plugin/soap/parser/Wsdl2Parser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Wsdl2Parser(
192192
// directly - instead an element must be used.
193193
getAttributeValueAsQName(inputOrOutputNode, "element")?.let { elementQName ->
194194
val ns = listOf(elementQName.toNamespaceMap())
195-
return resolveElementTypeFromXsd(elementQName)?.let { ElementOperationMessage(ns, elementQName, it) }
195+
return resolveElementTypeFromXsd(elementQName)?.let { ElementOperationMessage(ns, elementQName) }
196196

197197
} ?: throw IllegalStateException(
198198
"Invalid 'element' attribute for message input/output: ${inputOrOutputNode.name}"

mock/soap/src/main/java/io/gatehill/imposter/plugin/soap/service/SoapExampleService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class SoapExampleService {
7979
operation: WsdlOperation,
8080
bodyHolder: MessageBodyHolder,
8181
): Boolean {
82-
logger.debug("Generating example for {}", operation.outputRef)
82+
logger.debug("Generating response example for operation: {} in service: {}", operation.name, service.name)
8383
val example = when (operation.style) {
8484
SoapUtil.OPERATION_STYLE_DOCUMENT -> generateDocumentResponse(schemaContext, service, operation)
8585
SoapUtil.OPERATION_STYLE_RPC -> generateRpcResponse(schemaContext, service, operation)

0 commit comments

Comments
 (0)