Java应用中如何从指定SOAP WSDL地址过滤出createSimpleInvoice请求?
createSimpleInvoice Operation from Your WSDL Absolutely! You can pull out just the createSimpleInvoice operation and its related request definitions from that WSDL. Here are a few practical ways to do this, depending on your needs:
Manual Extraction (Quick & Dirty)
- First, save the full WSDL content to your computer: open the URL in your browser, right-click, and save the page as an
.xmlfile. - Open the file in a text editor with good XML support (like VS Code, Notepad++, or Sublime Text).
- Search for
<operation name="createSimpleInvoice">— this is the starting point of the operation you need. - Extract this
<operation>node, along with its associated<input>/<output>messages, and the corresponding<complexType>or<element>definitions that define the request structure. Don’t forget to copy over all the necessary namespace declarations from the root of the WSDL, otherwise your extracted fragment won’t be valid.
- First, save the full WSDL content to your computer: open the URL in your browser, right-click, and save the page as an
Use a WSDL Tool (Clean & Reliable)
Tools like SoapUI make this super easy:- Download and install SoapUI, then create a new SOAP project using your WSDL URL.
- Once the project loads, navigate to the
createSimpleInvoiceoperation under your service. - Right-click the operation and select "Export WSDL" — SoapUI will automatically generate a trimmed-down WSDL that only includes the
createSimpleInvoiceoperation and all its dependent types/namespaces. No manual cleanup needed!
If you prefer command-line tools, you can use Java’s built-in
wsimportto generate code only for the target operation, then reverse-engineer the relevant WSDL parts from the generated classes. The command would look something like this (adjust the package name to your needs):wsimport -keep -p com.yourcompany.invoice -XincludeMethods createSimpleInvoice https://egpb-test.fin.ap1.oraclecloud.com/finArTrxnsInvoices/InvoiceService/types/?WSDLAfter generating the code, you can look at the annotated classes to get the exact structure of the
createSimpleInvoicerequest.Scripted Extraction (For Automation)
If you need to do this programmatically, use a SOAP library like Python’szeepto parse the WSDL and extract the operation details:from zeep import Client # Load the WSDL client = Client('https://egpb-test.fin.ap1.oraclecloud.com/finArTrxnsInvoices/InvoiceService/types/?WSDL') # Get the createSimpleInvoice operation operation = client.service._binding._operations['createSimpleInvoice'] # Print the request signature to see the structure print("Request structure:", operation.input.signature()) # If you need the full XML schema for the request, you can access the type definition request_type = operation.input.type print("Request type details:", request_type)This script will give you precise access to the request’s structure, which you can then use to build your own trimmed WSDL or generate request templates.
Quick Notes
- Always make sure your extracted WSDL fragment includes all required namespaces — missing these will cause errors when you try to use the operation.
- If your main WSDL imports external XSD files, you’ll need to either include those imports in your trimmed WSDL or download the relevant parts of the XSDs that are used by
createSimpleInvoice.
内容的提问来源于stack exchange,提问作者Malan Jayanka

