lordxearo
Goto Top

Powershell Soap WSDL Mantis Bug Tracker

Hallo Zusammen,

ich versuche ein Ticket im Mantis über die SOAP-Schnittstelle zu erstellen. Ich möchte das mit Powershell lösen. Leider komme ich mit meinen Versuchen nicht weiter.

Hier ein Auszug aus Mantis:

Web Service: MantisConnect
Target Namespace: http://futureware.biz/mantisconnect
Port MantisConnect
Port Port type
Source code
Location:http://mantis/mantis/api/soap/mantisconnect.php
Protocol:SOAP
Default style:rpc
Transport protocol:SOAP over HTTP

Diese Methode müsste ich benutzen:
d759b0c8dcbed048414fe9ae32d0e59f


Das habe ich bisher probiert:
$mantis = New-WebServiceProxy -Uri http://mantis/mantis/api/soap/mantisconnect.php?wsdl 

$summary  = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.IssueData"  
#$project = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.ObjectRef"  
#$project=@{project="IT"}  


$summary=@{summary="test"}  


#$mantis | get-member -type method

$response = $mantis.mc_issue_add("username","password",$summary)  
$response

Ausgabe:
Ausnahme beim Aufrufen von "mc_issue_add" mit 3 Argument(en):  "Error Type: SYSTEM NOTICE,  
Error Description: Undefined index: project"  
In C:\Temp\mantis.ps1:13 Zeichen:1
+ $response = $mantis.mc_issue_add("username","pssword",$summary)   
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) , MethodInvocationException
    + FullyQualifiedErrorId : SoapHeaderException

Liesst sich so, als müsste project noch angegeben werden. Hier komm ich nun nicht mehr weiter. Project ist vom Typ ObjectRef. Mit dem anlegen des Datentyps bin ich mir schon unsicher, aber dass dann noch in die Methode "mc_issue_add" einzubinden, übersteigt leider meine Powershell kenntnisse.

Könnte mir da jemand Hilfestellung geben?

Danke und Gruß
Xearo

Content-Key: 272228

Url: https://administrator.de/contentid/272228

Printed on: April 19, 2024 at 04:04 o'clock

Mitglied: 114757
114757 May 18, 2015 updated at 11:06:36 (UTC)
Goto Top
Moin,
kenne zwar den Webservice jetzt nicht aber versuchs mal so:
$mantis = New-WebServiceProxy -Uri http://mantis/mantis/api/soap/mantisconnect.php?wsdl  
$issue  = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.IssueData"  
$issue.summary = "BlaBlaBla"  
$response = $mantis.mc_issue_add("username","password",$issue)   
Gruß jodel32
Member: LordXearo
LordXearo May 18, 2015 updated at 11:12:53 (UTC)
Goto Top
Hi Jodel,

danke für deine Unterstützung. So leicht scheint es nicht zu klappen.

Das Argument "issue" mit dem Wert  "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy  
1pi_soap_mantisconnect_php_wsdl.IssueData" für "mc_issue_add" kann nicht in den Typ "Microsoft.PowerShell.Commands.NewW  
ebserviceProxy.AutogeneratedTypes.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.IssueData" konvertiert werden: "Der  
Wert "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsd  
l.IssueData" vom Typ "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_manti  
sconnect_php_wsdl.IssueData" kann nicht in den Typ "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes  
.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.IssueData" konvertiert werden."  
In C:\Temp\mantis.ps1:19 Zeichen:1
+ $response = $mantis.mc_issue_add("username","password",$issue)  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) , MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Gruß
Xearo

Edit:
Habe das Object angeasst:
$issue  = New-Object "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.IssueData"  

Und erhalte jetzt wieder:
Ausnahme beim Aufrufen von "mc_issue_add" mit 3 Argument(en):  "Error Type: SYSTEM NOTICE,  
Error Description: Undefined index: project"  
In C:\Temp\mantis.ps1:19 Zeichen:1
+ $response = $mantis.mc_issue_add("username","password",$issue)  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) , MethodInvocationException
    + FullyQualifiedErrorId : SoapHeaderException
Mitglied: 114757
114757 May 18, 2015 updated at 11:20:35 (UTC)
Goto Top
Ohne Zugriff auf den Webservice von hier aus schwer zu debuggen. Die Eigenschaft project ist eigentlich als optional gekennzeichnet, gibt es in der Struktur noch Eigenschaften die mandatory(Pflicht) sind, leider ist das Bild abgeschnitten ?
Kannst du den Dienst vielleicht online stellen, URL dann via PM ?
Member: LordXearo
LordXearo May 18, 2015 at 11:24:55 (UTC)
Goto Top
Hier scheint es eine online demo zugeben.

http://demo.teclib.net/mantis/api/soap/mantisconnect.php?wsdl
Mitglied: 114757
Solution 114757 May 18, 2015 updated at 11:47:23 (UTC)
Goto Top
Zitat von @LordXearo:

Hier scheint es eine online demo zugeben.

http://demo.teclib.net/mantis/api/soap/mantisconnect.php?wsdl
username password ?

probiers mal so:
$mantis = New-WebServiceProxy -Uri 'http://mantis/mantis/api/soap/mantisconnect.php?wsdl'  
$issue  = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.IssueData
$project = new-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1pi_soap_mantisconnect_php_wsdl.ObjectRef
$project.id = 1
$project.name = "Testname"  
$issue.project = $project
$issue.summary = "BlaBla"  
$mantis.mc_issue_add("username","password",$issue)  
Ein Projekt mit der ID muss vermutlich existieren.
Member: LordXearo
LordXearo May 18, 2015 at 11:47:19 (UTC)
Goto Top
Klasse Jodel, es funktioniert =)
Description und category sind anscheinend auch noch mandatory.

$mantis = New-WebServiceProxy -Uri 'http://mantis/mantis/api/soap/mantisconnect.php?wsdl'  
$issue  = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.IssueData
$project = new-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy3pi_soap_mantisconnect_php_wsdl.ObjectRef
$project.id = 1
$project.name = "Testname"  
$issue.project = $project
$issue.summary = "BlaBla"  
$issue.description = "BlaBla"  
$issue.category = "Hardware"  
$response = $mantis.mc_issue_add("username","password",$issue)  
$response 

Wäre es Java gewesen, wäre ich wahrscheinlich noch selber drauf gekommen, die Attribute direkt am erzeugten Object zu belegen *autsch*.

Besten Dank
Gruß
Xearo